From 60c1c95b832121cc1c7745120c1b48f71f8179b8 Mon Sep 17 00:00:00 2001 From: Pablo Veyrat <50438397+sogipec@users.noreply.github.com> Date: Mon, 5 Aug 2024 18:14:04 +0200 Subject: [PATCH] Router upgrade (#25) * checking the routing contracts * feat: deploy new router implementations * fix: linea router * fix: lint --- contracts/BaseAngleRouterSidechain.sol | 62 -- contracts/BaseRouter.sol | 35 +- .../arbitrum/AngleRouterArbitrum.sol | 4 +- .../avalanche/AngleRouterAvalanche.sol | 4 +- .../implementations/base/AngleRouterBase.sol | 4 +- .../implementations/celo/AngleRouterCelo.sol | 4 +- .../gnosis/AngleRouterGnosis.sol | 4 +- .../linea/AngleRouterLinea.sol | 15 + .../optimism/AngleRouterOptimism.sol | 4 +- .../polygon/AngleRouterPolygon.sol | 4 +- contracts/interfaces/IDepositWithReferral.sol | 25 + contracts/mock/MockRouterSidechain.sol | 4 +- deploy/networks/linea.json | 4 + .../{routerSidechain.ts => routerDeploy.ts} | 17 +- deploy/routerMainnet.ts | 26 - ...ngleRouterArbitrumV3_0_Implementation.json | 618 ++++++++++++++ .../0d1b1c94fd2e1964436c8b9a0e25c545.json | 142 +++ ...gleRouterAvalancheV3_0_Implementation.json | 618 ++++++++++++++ .../0d1b1c94fd2e1964436c8b9a0e25c545.json | 142 +++ .../AngleRouterBaseV3_0_Implementation.json | 618 ++++++++++++++ .../0d1b1c94fd2e1964436c8b9a0e25c545.json | 142 +++ .../AngleRouterCeloV3_0_Implementation.json | 618 ++++++++++++++ .../0d1b1c94fd2e1964436c8b9a0e25c545.json | 142 +++ .../AngleRouterGnosisV3_0_Implementation.json | 618 ++++++++++++++ .../0d1b1c94fd2e1964436c8b9a0e25c545.json | 142 +++ deployments/linea/.chainId | 1 + deployments/linea/AngleRouterLineaV2.json | 247 ++++++ deployments/linea/AngleRouterLineaV3.json | 247 ++++++ .../AngleRouterLineaV3_0_Implementation.json | 618 ++++++++++++++ .../2560f9a5795a08bc300fefd5eee2c52b.json | 298 +++++++ ...AngleRouterMainnetV3_0_Implementation.json | 808 ++++++++++++++++++ .../0d1b1c94fd2e1964436c8b9a0e25c545.json | 142 +++ ...ngleRouterOptimismV3_0_Implementation.json | 618 ++++++++++++++ .../0d1b1c94fd2e1964436c8b9a0e25c545.json | 142 +++ ...AngleRouterPolygonV3_0_Implementation.json | 633 ++++++++++++++ .../0d1b1c94fd2e1964436c8b9a0e25c545.json | 142 +++ hardhat.config.ts | 20 +- package.json | 8 +- scripts/e2e/linea/AngleRouterLinea.test.ts | 144 ++++ .../RouterSidechainSavingsRateActions.t.sol | 2 +- .../router/baseAngleRouterSidechain.test.ts | 312 ------- utils/network.ts | 8 + yarn.lock | 50 +- 43 files changed, 7962 insertions(+), 494 deletions(-) delete mode 100644 contracts/BaseAngleRouterSidechain.sol create mode 100644 contracts/implementations/linea/AngleRouterLinea.sol create mode 100644 contracts/interfaces/IDepositWithReferral.sol create mode 100644 deploy/networks/linea.json rename deploy/{routerSidechain.ts => routerDeploy.ts} (85%) delete mode 100644 deploy/routerMainnet.ts create mode 100644 deployments/arbitrum/AngleRouterArbitrumV3_0_Implementation.json create mode 100644 deployments/arbitrum/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json create mode 100644 deployments/avalanche/AngleRouterAvalancheV3_0_Implementation.json create mode 100644 deployments/avalanche/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json create mode 100644 deployments/base/AngleRouterBaseV3_0_Implementation.json create mode 100644 deployments/base/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json create mode 100644 deployments/celo/AngleRouterCeloV3_0_Implementation.json create mode 100644 deployments/celo/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json create mode 100644 deployments/gnosis/AngleRouterGnosisV3_0_Implementation.json create mode 100644 deployments/gnosis/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json create mode 100644 deployments/linea/.chainId create mode 100644 deployments/linea/AngleRouterLineaV2.json create mode 100644 deployments/linea/AngleRouterLineaV3.json create mode 100644 deployments/linea/AngleRouterLineaV3_0_Implementation.json create mode 100644 deployments/linea/solcInputs/2560f9a5795a08bc300fefd5eee2c52b.json create mode 100644 deployments/mainnet/AngleRouterMainnetV3_0_Implementation.json create mode 100644 deployments/mainnet/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json create mode 100644 deployments/optimism/AngleRouterOptimismV3_0_Implementation.json create mode 100644 deployments/optimism/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json create mode 100644 deployments/polygon/AngleRouterPolygonV3_0_Implementation.json create mode 100644 deployments/polygon/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json create mode 100644 scripts/e2e/linea/AngleRouterLinea.test.ts delete mode 100644 test/hardhat/router/baseAngleRouterSidechain.test.ts diff --git a/contracts/BaseAngleRouterSidechain.sol b/contracts/BaseAngleRouterSidechain.sol deleted file mode 100644 index aef9ed4..0000000 --- a/contracts/BaseAngleRouterSidechain.sol +++ /dev/null @@ -1,62 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0 - -pragma solidity ^0.8.17; - -import "./interfaces/IAgTokenMultiChain.sol"; -import "./BaseRouter.sol"; - -/// @title BaseAngleRouterSidechain -/// @author Angle Core Team -/// @notice Extension of the `BaseRouter` contract for sidechains -abstract contract BaseAngleRouterSidechain is BaseRouter { - // =========================== ROUTER FUNCTIONALITIES ========================== - - /// @notice Wrapper built on top of the `_claimRewards` function. It allows to claim rewards for multiple - /// gauges at once - /// @param gaugeUser Address for which to fetch the rewards from the gauges - /// @param liquidityGauges Gauges to claim on - /// @dev If the caller wants to send the rewards to another account it first needs to - /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge` - function claimRewards(address gaugeUser, address[] calldata liquidityGauges) external { - _claimRewards(gaugeUser, liquidityGauges); - } - - /// @inheritdoc BaseRouter - function _chainSpecificAction(ActionType action, bytes calldata data) internal override { - if (action == ActionType.swapIn) { - (address canonicalToken, address bridgeToken, uint256 amount, uint256 minAmountOut, address to) = abi - .decode(data, (address, address, uint256, uint256, address)); - _swapIn(canonicalToken, bridgeToken, amount, minAmountOut, to); - } else if (action == ActionType.swapOut) { - (address canonicalToken, address bridgeToken, uint256 amount, uint256 minAmountOut, address to) = abi - .decode(data, (address, address, uint256, uint256, address)); - _swapOut(canonicalToken, bridgeToken, amount, minAmountOut, to); - } - } - - /// @notice Wraps a bridge token to its corresponding canonical version - function _swapIn( - address canonicalToken, - address bridgeToken, - uint256 amount, - uint256 minAmountOut, - address to - ) internal returns (uint256) { - amount = IAgTokenMultiChain(canonicalToken).swapIn(bridgeToken, amount, to); - _slippageCheck(amount, minAmountOut); - return amount; - } - - /// @notice Unwraps a canonical token for one of its bridge version - function _swapOut( - address canonicalToken, - address bridgeToken, - uint256 amount, - uint256 minAmountOut, - address to - ) internal returns (uint256) { - amount = IAgTokenMultiChain(canonicalToken).swapOut(bridgeToken, amount, to); - _slippageCheck(amount, minAmountOut); - return amount; - } -} diff --git a/contracts/BaseRouter.sol b/contracts/BaseRouter.sol index ee26a98..3d6b414 100644 --- a/contracts/BaseRouter.sol +++ b/contracts/BaseRouter.sol @@ -43,6 +43,7 @@ import "@openzeppelin/contracts/interfaces/IERC4626.sol"; import "./interfaces/external/uniswap/IUniswapRouter.sol"; import "./interfaces/external/IWETH9.sol"; import "./interfaces/ICoreBorrow.sol"; +import "./interfaces/IDepositWithReferral.sol"; import "./interfaces/ILiquidityGauge.sol"; import "./interfaces/ISwapper.sol"; import "./interfaces/IVaultManager.sol"; @@ -72,7 +73,9 @@ enum ActionType { prepareRedeemSavingsRate, // Deprecated claimRedeemSavingsRate, + // Deprecated swapIn, + // Deprecated swapOut, claimWeeklyInterest, // Deprecated @@ -117,7 +120,7 @@ struct PermitVaultManagerType { /// @author Angle Core Team /// @notice Base contract that Angle router contracts on different chains should override /// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol -abstract contract BaseRouter is Initializable { +abstract contract BaseRouter is Initializable, IDepositWithReferral { using SafeERC20 for IERC20; // ================================= REFERENCES ================================ @@ -152,11 +155,7 @@ abstract contract BaseRouter is Initializable { ); /// @notice Deploys the router contract on a chain - function initializeRouter( - address _core, - address _uniswapRouter, - address _oneInch - ) public initializer { + function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer { if (_core == address(0)) revert ZeroAddress(); core = ICoreBorrow(_core); uniswapV3Router = IUniswapV3Router(_uniswapRouter); @@ -293,16 +292,16 @@ abstract contract BaseRouter is Initializable { /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track /// addresses depositing from a certain referring address into an ERC4626 contract function deposit4626Referral( - IERC20 token, - IERC4626 savings, + address token, + address savings, uint256 amount, address to, uint256 minSharesOut, address referrer - ) external { - token.safeTransferFrom(msg.sender, address(this), amount); - _changeAllowance(token, address(savings), type(uint256).max); - _deposit4626Referral(savings, amount, to, minSharesOut, referrer); + ) external returns (uint256 sharesOut) { + IERC20(token).safeTransferFrom(msg.sender, address(this), amount); + _changeAllowance(IERC20(token), savings, type(uint256).max); + sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer); } /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing @@ -407,11 +406,7 @@ abstract contract BaseRouter is Initializable { /// @param tokenOut Token to sweep /// @param minAmountOut Minimum amount of tokens to recover /// @param to Address to which tokens should be sent - function _sweep( - address tokenOut, - uint256 minAmountOut, - address to - ) internal virtual { + function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual { uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this)); _slippageCheck(balanceToken, minAmountOut); if (balanceToken != 0) { @@ -582,11 +577,7 @@ abstract contract BaseRouter is Initializable { /// @param token Address of the token to change allowance /// @param spender Address to change the allowance of /// @param amount Amount allowed - function _changeAllowance( - IERC20 token, - address spender, - uint256 amount - ) internal { + function _changeAllowance(IERC20 token, address spender, uint256 amount) internal { uint256 currentAllowance = token.allowance(address(this), spender); // In case `currentAllowance < type(uint256).max / 2` and we want to increase it: // Do nothing (to handle tokens that need reapprovals to 0 and save gas) diff --git a/contracts/implementations/arbitrum/AngleRouterArbitrum.sol b/contracts/implementations/arbitrum/AngleRouterArbitrum.sol index 9d7df03..7985e5a 100644 --- a/contracts/implementations/arbitrum/AngleRouterArbitrum.sol +++ b/contracts/implementations/arbitrum/AngleRouterArbitrum.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.17; -import "../../BaseAngleRouterSidechain.sol"; +import "../../BaseRouter.sol"; /// @title AngleRouterArbitrum /// @author Angle Core Team /// @notice Router contract built specifially for Angle use cases on Arbitrum -contract AngleRouterArbitrum is BaseAngleRouterSidechain { +contract AngleRouterArbitrum is BaseRouter { /// @inheritdoc BaseRouter function _getNativeWrapper() internal pure override returns (IWETH9) { return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1); diff --git a/contracts/implementations/avalanche/AngleRouterAvalanche.sol b/contracts/implementations/avalanche/AngleRouterAvalanche.sol index 9b6caf1..a1a0c51 100644 --- a/contracts/implementations/avalanche/AngleRouterAvalanche.sol +++ b/contracts/implementations/avalanche/AngleRouterAvalanche.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.17; -import "../../BaseAngleRouterSidechain.sol"; +import "../../BaseRouter.sol"; /// @title AngleRouterAvalanche /// @author Angle Core Team /// @notice Router contract built specifially for Angle use cases on Avalanche -contract AngleRouterAvalanche is BaseAngleRouterSidechain { +contract AngleRouterAvalanche is BaseRouter { /// @inheritdoc BaseRouter function _getNativeWrapper() internal pure override returns (IWETH9) { return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7); diff --git a/contracts/implementations/base/AngleRouterBase.sol b/contracts/implementations/base/AngleRouterBase.sol index 4e2422b..8394db0 100644 --- a/contracts/implementations/base/AngleRouterBase.sol +++ b/contracts/implementations/base/AngleRouterBase.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.17; -import "../../BaseAngleRouterSidechain.sol"; +import "../../BaseRouter.sol"; /// @title AngleRouterBase /// @author Angle Core Team /// @notice Router contract built specifially for Angle use cases on Base -contract AngleRouterBase is BaseAngleRouterSidechain { +contract AngleRouterBase is BaseRouter { /// @inheritdoc BaseRouter /// @dev There is no wCELO contract on CELO function _getNativeWrapper() internal pure override returns (IWETH9) { diff --git a/contracts/implementations/celo/AngleRouterCelo.sol b/contracts/implementations/celo/AngleRouterCelo.sol index 020a7aa..92e56bc 100644 --- a/contracts/implementations/celo/AngleRouterCelo.sol +++ b/contracts/implementations/celo/AngleRouterCelo.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.17; -import "../../BaseAngleRouterSidechain.sol"; +import "../../BaseRouter.sol"; /// @title AngleRouterCelo /// @author Angle Core Team /// @notice Router contract built specifially for Angle use cases on Celo -contract AngleRouterCelo is BaseAngleRouterSidechain { +contract AngleRouterCelo is BaseRouter { /// @inheritdoc BaseRouter /// @dev There is no wCELO contract on CELO function _getNativeWrapper() internal pure override returns (IWETH9) { diff --git a/contracts/implementations/gnosis/AngleRouterGnosis.sol b/contracts/implementations/gnosis/AngleRouterGnosis.sol index 81e5685..4ff9776 100644 --- a/contracts/implementations/gnosis/AngleRouterGnosis.sol +++ b/contracts/implementations/gnosis/AngleRouterGnosis.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.17; -import "../../BaseAngleRouterSidechain.sol"; +import "../../BaseRouter.sol"; /// @title AngleRouterGnosis /// @author Angle Core Team /// @notice Router contract built specifially for Angle use cases on Gnosis -contract AngleRouterGnosis is BaseAngleRouterSidechain { +contract AngleRouterGnosis is BaseRouter { /// @inheritdoc BaseRouter function _getNativeWrapper() internal pure override returns (IWETH9) { return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d); diff --git a/contracts/implementations/linea/AngleRouterLinea.sol b/contracts/implementations/linea/AngleRouterLinea.sol new file mode 100644 index 0000000..5d3d599 --- /dev/null +++ b/contracts/implementations/linea/AngleRouterLinea.sol @@ -0,0 +1,15 @@ +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity ^0.8.17; + +import "../../BaseRouter.sol"; + +/// @title AngleRouterLinea +/// @author Angle Core Team +/// @notice Router contract built specifially for Angle use cases on Linea +contract AngleRouterLinea is BaseRouter { + /// @inheritdoc BaseRouter + function _getNativeWrapper() internal pure override returns (IWETH9) { + return IWETH9(0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f); + } +} diff --git a/contracts/implementations/optimism/AngleRouterOptimism.sol b/contracts/implementations/optimism/AngleRouterOptimism.sol index 7db44ad..9ac54ef 100644 --- a/contracts/implementations/optimism/AngleRouterOptimism.sol +++ b/contracts/implementations/optimism/AngleRouterOptimism.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.17; -import "../../BaseAngleRouterSidechain.sol"; +import "../../BaseRouter.sol"; /// @title AngleRouterOptimism /// @author Angle Core Team /// @notice Router contract built specifially for Angle use cases on Optimism -contract AngleRouterOptimism is BaseAngleRouterSidechain { +contract AngleRouterOptimism is BaseRouter { /// @inheritdoc BaseRouter function _getNativeWrapper() internal pure override returns (IWETH9) { return IWETH9(0x4200000000000000000000000000000000000006); diff --git a/contracts/implementations/polygon/AngleRouterPolygon.sol b/contracts/implementations/polygon/AngleRouterPolygon.sol index 83c2e17..49fd12e 100644 --- a/contracts/implementations/polygon/AngleRouterPolygon.sol +++ b/contracts/implementations/polygon/AngleRouterPolygon.sol @@ -2,12 +2,12 @@ pragma solidity ^0.8.17; -import "../../BaseAngleRouterSidechain.sol"; +import "../../BaseRouter.sol"; /// @title AngleRouterPolygon /// @author Angle Core Team /// @notice Router contract built specifially for Angle use cases on Polygon -contract AngleRouterPolygon is BaseAngleRouterSidechain { +contract AngleRouterPolygon is BaseRouter { /// @inheritdoc BaseRouter function _getNativeWrapper() internal pure override returns (IWETH9) { return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270); diff --git a/contracts/interfaces/IDepositWithReferral.sol b/contracts/interfaces/IDepositWithReferral.sol new file mode 100644 index 0000000..6c341c9 --- /dev/null +++ b/contracts/interfaces/IDepositWithReferral.sol @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: GPL-3.0 + +pragma solidity >=0.5.0; + +/// @title IDepositWithReferral +/// @author Angle Core Team +/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address +interface IDepositWithReferral { + /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset) + /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is + /// obtained, the function reverts + /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered + /// and the referrer address has no storage implication, it just changes the event emitted by this contract + /// when a deposit takes place + /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to + /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`) + function deposit4626Referral( + address token, + address savings, + uint256 amount, + address to, + uint256 minSharesOut, + address referrer + ) external returns (uint256 sharesOut); +} diff --git a/contracts/mock/MockRouterSidechain.sol b/contracts/mock/MockRouterSidechain.sol index 973d98b..58a7071 100644 --- a/contracts/mock/MockRouterSidechain.sol +++ b/contracts/mock/MockRouterSidechain.sol @@ -8,12 +8,12 @@ import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import "../interfaces/external/IWETH9.sol"; -import "../BaseAngleRouterSidechain.sol"; +import "../BaseRouter.sol"; /// @title MockRouterSidechain /// @author Angle Core Team /// @notice Mock contract but built for tests as if to be deployed on Ethereum -contract MockRouterSidechain is BaseAngleRouterSidechain { +contract MockRouterSidechain is BaseRouter { IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2); function _wrapNative() internal pure override returns (uint256) { diff --git a/deploy/networks/linea.json b/deploy/networks/linea.json new file mode 100644 index 0000000..ada14d2 --- /dev/null +++ b/deploy/networks/linea.json @@ -0,0 +1,4 @@ +{ + "oneInchRouter": "0x0000000000000000000000000000000000000000", + "uniswapV3Router": "0x0000000000000000000000000000000000000000" +} diff --git a/deploy/routerSidechain.ts b/deploy/routerDeploy.ts similarity index 85% rename from deploy/routerSidechain.ts rename to deploy/routerDeploy.ts index b913b1f..0ab91e1 100644 --- a/deploy/routerSidechain.ts +++ b/deploy/routerDeploy.ts @@ -16,27 +16,30 @@ const func: DeployFunction = async ({ ethers, deployments, network }) => { let chainName: string; if (!network.live) { - chainId = ChainId.BASE; - chainName = 'Base'; + chainId = ChainId.LINEA; + chainName = 'Linea'; } else { - chainId = ChainId.BASE; + chainId = ChainId.LINEA; chainName = network.name.charAt(0).toUpperCase() + network.name.substring(1); } const contractName = `AngleRouter${chainName}`; console.log('Now deploying the implementation'); - await deploy(`${contractName}V2_1_Implementation`, { + /* + await deploy(`${contractName}V3_0_Implementation`, { contract: contractName, from: deployer.address, log: !argv.ci, }); + */ - const routerImplementation = (await ethers.getContract(`${contractName}V2_1_Implementation`)).address; + const routerImplementation = (await ethers.getContract(`${contractName}V3_0_Implementation`)).address; console.log(`Successfully deployed the implementation for the router at ${routerImplementation}`); const proxyAdmin = registry(chainId)?.ProxyAdminGuardian; const coreBorrow = registry(chainId)?.CoreBorrow; + // const coreBorrow = "0x4b1E2c2762667331Bc91648052F646d1b0d35984"; console.log(proxyAdmin, coreBorrow); console.log('Now deploying the proxy contract'); const dataRouter = new ethers.Contract( @@ -44,7 +47,7 @@ const func: DeployFunction = async ({ ethers, deployments, network }) => { AngleRouterPolygon__factory.createInterface(), ).interface.encodeFunctionData('initializeRouter', [coreBorrow, json.uniswapV3Router, json.oneInchRouter]); - await deploy(`${contractName}V2`, { + await deploy(`${contractName}V3`, { contract: 'TransparentUpgradeableProxy', from: deployer.address, args: [routerImplementation, proxyAdmin, dataRouter], @@ -58,5 +61,5 @@ const func: DeployFunction = async ({ ethers, deployments, network }) => { console.log('Success'); }; -func.tags = ['routerSidechain']; +func.tags = ['router']; export default func; diff --git a/deploy/routerMainnet.ts b/deploy/routerMainnet.ts deleted file mode 100644 index 2eccc57..0000000 --- a/deploy/routerMainnet.ts +++ /dev/null @@ -1,26 +0,0 @@ -import { DeployFunction } from 'hardhat-deploy/types'; -import yargs from 'yargs'; - -const argv = yargs.env('').boolean('ci').parseSync(); - -const func: DeployFunction = async ({ ethers, deployments, network }) => { - const { deploy } = deployments; - const { deployer } = await ethers.getNamedSigners(); - - console.log('Deploying router'); - - console.log('Now deploying implementation'); - - await deploy('AngleRouterMainnetV2_2_Implementation', { - contract: 'AngleRouterMainnet', - from: deployer.address, - log: !argv.ci, - }); - - const angleRouterImplementation = (await deployments.get('AngleRouterMainnetV2_2_Implementation')).address; - console.log(`Successfully deployed Angle router implementation at the address ${angleRouterImplementation}`); - console.log(''); -}; - -func.tags = ['routerMainnet']; -export default func; diff --git a/deployments/arbitrum/AngleRouterArbitrumV3_0_Implementation.json b/deployments/arbitrum/AngleRouterArbitrumV3_0_Implementation.json new file mode 100644 index 0000000..ad8b6b0 --- /dev/null +++ b/deployments/arbitrum/AngleRouterArbitrumV3_0_Implementation.json @@ -0,0 +1,618 @@ +{ + "address": "0xa611607f01eEEA57DCc7a234A238fDc99D58065d", + "abi": [ + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReturnMessage", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferredDeposit", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "spenders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "changeAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit4626Referral", + "outputs": [ + { + "internalType": "uint256", + "name": "sharesOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_uniswapRouter", + "type": "address" + }, + { + "internalType": "address", + "name": "_oneInch", + "type": "address" + } + ], + "name": "initializeRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vaultManager", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitVaultManagerType[]", + "name": "paramsPermitVaultManager", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixerVaultManagerPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "oneInch", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "_core", + "type": "address" + } + ], + "name": "setCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "internalType": "uint8", + "name": "who", + "type": "uint8" + } + ], + "name": "setRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "uniswapV3Router", + "outputs": [ + { + "internalType": "contract IUniswapV3Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x2327f37a2afcfbc55d80f9e59014f93d690765117241bfae4eeedf723d7be4c1", + "receipt": { + "to": null, + "from": "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701", + "contractAddress": "0xa611607f01eEEA57DCc7a234A238fDc99D58065d", + "transactionIndex": 6, + "gasUsed": "4144807", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000200000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000", + "blockHash": "0xcf771543dd7a39aa545d0e84b80c0db7696b13776fcb73888feb505b8ebb1835", + "transactionHash": "0x2327f37a2afcfbc55d80f9e59014f93d690765117241bfae4eeedf723d7be4c1", + "logs": [ + { + "transactionIndex": 6, + "blockNumber": 210779948, + "transactionHash": "0x2327f37a2afcfbc55d80f9e59014f93d690765117241bfae4eeedf723d7be4c1", + "address": "0xa611607f01eEEA57DCc7a234A238fDc99D58065d", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 17, + "blockHash": "0xcf771543dd7a39aa545d0e84b80c0db7696b13776fcb73888feb505b8ebb1835" + } + ], + "blockNumber": 210779948, + "cumulativeGasUsed": "5089533", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0d1b1c94fd2e1964436c8b9a0e25c545", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReturnMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApprovedOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferredDeposit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"spenders\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"changeAllowance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minSharesOut\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"deposit4626Referral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sharesOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_uniswapRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oneInch\",\"type\":\"address\"}],\"name\":\"initializeRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"vaultManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitVaultManagerType[]\",\"name\":\"paramsPermitVaultManager\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixerVaultManagerPermit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oneInch\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"setCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"who\",\"type\":\"uint8\"}],\"name\":\"setRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV3Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Router\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"params\":{\"amounts\":\"Amounts to allow\",\"spenders\":\"Addresses to allow transfer\",\"tokens\":\"Addresses of the tokens to allow\"}},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens\",\"params\":{\"actions\":\"List of actions to be performed by the router (in order of execution)\",\"data\":\"Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored\",\"paramsPermit\":\"Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\"}},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option\",\"params\":{\"paramsPermitVaultManager\":\"Parameters to sign permit to give allowance to the router for a `VaultManager` contract\"}}},\"title\":\"AngleRouterArbitrum\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"notice\":\"Changes allowances for different tokens\"},\"core()\":{\"notice\":\"Core address handling access control\"},\"deposit4626Referral(address,address,uint256,address,uint256,address)\":{\"notice\":\"Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract\"},\"initializeRouter(address,address,address)\":{\"notice\":\"Deploys the router contract on a chain\"},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Allows composable calls to different functions within the protocol\"},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions\"},\"oneInch()\":{\"notice\":\"Address of 1Inch router used for swaps\"},\"setCore(address)\":{\"notice\":\"Sets a new `core` contract\"},\"setRouter(address,uint8)\":{\"notice\":\"Sets a new router variable\"},\"uniswapV3Router()\":{\"notice\":\"Address of the router used for swaps\"}},\"notice\":\"Router contract built specifially for Angle use cases on Arbitrum\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/implementations/arbitrum/AngleRouterArbitrum.sol\":\"AngleRouterArbitrum\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x9750c6fec736eb3320e85924f36a3060fa4a4ab1758d06d9585e175d164eefdb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\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 IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\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 require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\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 */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\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. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"contracts/BaseRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport \\\"./interfaces/external/uniswap/IUniswapRouter.sol\\\";\\nimport \\\"./interfaces/external/IWETH9.sol\\\";\\nimport \\\"./interfaces/ICoreBorrow.sol\\\";\\nimport \\\"./interfaces/IDepositWithReferral.sol\\\";\\nimport \\\"./interfaces/ILiquidityGauge.sol\\\";\\nimport \\\"./interfaces/ISwapper.sol\\\";\\nimport \\\"./interfaces/IVaultManager.sol\\\";\\n\\n// ============================== STRUCTS AND ENUM =============================\\n\\n/// @notice Action types\\nenum ActionType {\\n transfer,\\n wrapNative,\\n unwrapNative,\\n sweep,\\n sweepNative,\\n // Deprecated\\n uniswapV3,\\n oneInch,\\n claimRewards,\\n // Deprecated\\n gaugeDeposit,\\n borrower,\\n swapper,\\n mint4626,\\n deposit4626,\\n redeem4626,\\n withdraw4626,\\n // Deprecated\\n prepareRedeemSavingsRate,\\n // Deprecated\\n claimRedeemSavingsRate,\\n // Deprecated\\n swapIn,\\n // Deprecated\\n swapOut,\\n claimWeeklyInterest,\\n // Deprecated\\n withdraw,\\n // Deprecated\\n mint,\\n // Deprecated\\n deposit,\\n // Deprecated\\n openPerpetual,\\n // Deprecated\\n addToPerpetual,\\n veANGLEDeposit,\\n // Deprecated\\n claimRewardsWithPerps,\\n deposit4626Referral\\n}\\n\\n/// @notice Data needed to get permits\\nstruct PermitType {\\n address token;\\n address owner;\\n uint256 value;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @notice Data to grant permit to the router for a vault\\nstruct PermitVaultManagerType {\\n address vaultManager;\\n address owner;\\n bool approved;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @title BaseRouter\\n/// @author Angle Core Team\\n/// @notice Base contract that Angle router contracts on different chains should override\\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\\n using SafeERC20 for IERC20;\\n\\n // ================================= REFERENCES ================================\\n\\n /// @notice Core address handling access control\\n ICoreBorrow public core;\\n /// @notice Address of the router used for swaps\\n IUniswapV3Router public uniswapV3Router;\\n /// @notice Address of 1Inch router used for swaps\\n address public oneInch;\\n\\n uint256[47] private __gap;\\n\\n // ============================== EVENTS / ERRORS ==============================\\n\\n error IncompatibleLengths();\\n error InvalidReturnMessage();\\n error NotApprovedOrOwner();\\n error NotGovernor();\\n error NotGovernorOrGuardian();\\n error TooSmallAmountOut();\\n error TransferFailed();\\n error ZeroAddress();\\n\\n event ReferredDeposit(\\n address caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares,\\n address indexed savings,\\n address indexed referrer\\n );\\n\\n /// @notice Deploys the router contract on a chain\\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\\n if (_core == address(0)) revert ZeroAddress();\\n core = ICoreBorrow(_core);\\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\\n oneInch = _oneInch;\\n }\\n\\n constructor() initializer {}\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @notice Allows composable calls to different functions within the protocol\\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\\n /// @param actions List of actions to be performed by the router (in order of execution)\\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\\n /// for a given action are stored\\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\\n /// do not perform a sweep action on these tokens\\n function mixer(\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) public payable virtual {\\n // If all tokens have already been approved, there's no need for this step\\n uint256 permitsLength = paramsPermit.length;\\n for (uint256 i; i < permitsLength; ++i) {\\n IERC20Permit(paramsPermit[i].token).permit(\\n paramsPermit[i].owner,\\n address(this),\\n paramsPermit[i].value,\\n paramsPermit[i].deadline,\\n paramsPermit[i].v,\\n paramsPermit[i].r,\\n paramsPermit[i].s\\n );\\n }\\n // Performing actions one after the others\\n uint256 actionsLength = actions.length;\\n for (uint256 i; i < actionsLength; ++i) {\\n if (actions[i] == ActionType.transfer) {\\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\\n } else if (actions[i] == ActionType.wrapNative) {\\n _wrapNative();\\n } else if (actions[i] == ActionType.unwrapNative) {\\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\\n _unwrapNative(minAmountOut, to);\\n } else if (actions[i] == ActionType.sweep) {\\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\\n _sweep(tokenOut, minAmountOut, to);\\n } else if (actions[i] == ActionType.sweepNative) {\\n uint256 routerBalance = address(this).balance;\\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\\n } else if (actions[i] == ActionType.oneInch) {\\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\\n data[i],\\n (address, uint256, bytes)\\n );\\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\\n } else if (actions[i] == ActionType.claimRewards) {\\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\\n _claimRewards(user, claimLiquidityGauges);\\n } else if (actions[i] == ActionType.borrower) {\\n (\\n address collateral,\\n address vaultManager,\\n address to,\\n address who,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n bytes memory repayData\\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\\n } else if (actions[i] == ActionType.swapper) {\\n (\\n ISwapper swapperContract,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory payload\\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\\n } else if (actions[i] == ActionType.mint4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _mint4626(savingsRate, shares, to, maxAmountIn);\\n } else if (actions[i] == ActionType.deposit4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626(savingsRate, amount, to, minSharesOut);\\n } else if (actions[i] == ActionType.deposit4626Referral) {\\n (\\n IERC20 token,\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\\n } else if (actions[i] == ActionType.redeem4626) {\\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _redeem4626(savingsRate, shares, to, minAmountOut);\\n } else if (actions[i] == ActionType.withdraw4626) {\\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\\n } else {\\n _chainSpecificAction(actions[i], data[i]);\\n }\\n }\\n }\\n\\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\\n /// addresses depositing from a certain referring address into an ERC4626 contract\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut) {\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n _changeAllowance(IERC20(token), savings, type(uint256).max);\\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\\n }\\n\\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\\n /// actions and then revoking this approval after these actions\\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\\n /// to revoke approvals\\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\\n /// is just an option\\n function mixerVaultManagerPermit(\\n PermitVaultManagerType[] memory paramsPermitVaultManager,\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) external payable virtual {\\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n true,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n } else break;\\n }\\n mixer(paramsPermit, actions, data);\\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\\n // too deep\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (!paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n false,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n }\\n }\\n }\\n\\n receive() external payable {}\\n\\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\\n\\n /// @notice Wraps the native token of a chain to its wrapped version\\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\\n /// @dev The amount to wrap is to be specified in the `msg.value`\\n function _wrapNative() internal virtual returns (uint256) {\\n _getNativeWrapper().deposit{ value: msg.value }();\\n return msg.value;\\n }\\n\\n /// @notice Unwraps the wrapped version of a token to the native chain token\\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\\n amount = _getNativeWrapper().balanceOf(address(this));\\n _slippageCheck(amount, minAmountOut);\\n if (amount != 0) {\\n _getNativeWrapper().withdraw(amount);\\n _safeTransferNative(to, amount);\\n }\\n return amount;\\n }\\n\\n /// @notice Internal version of the `claimRewards` function\\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\\n uint256 gaugesLength = liquidityGauges.length;\\n for (uint256 i; i < gaugesLength; ++i) {\\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\\n }\\n }\\n\\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\\n /// @param vaultManager Address of the vault to perform actions on\\n /// @param actionsBorrow Actions type to perform on the vaultManager\\n /// @param dataBorrow Data needed for each actions\\n /// @param to Address to send the funds to\\n /// @param who Swapper address to handle repayments\\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\\n function _angleBorrower(\\n address vaultManager,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address to,\\n address who,\\n bytes memory repayData\\n ) internal virtual returns (PaymentData memory paymentData) {\\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\\n }\\n\\n /// @notice Sweeps tokens from the router contract\\n /// @param tokenOut Token to sweep\\n /// @param minAmountOut Minimum amount of tokens to recover\\n /// @param to Address to which tokens should be sent\\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\\n _slippageCheck(balanceToken, minAmountOut);\\n if (balanceToken != 0) {\\n IERC20(tokenOut).safeTransfer(to, balanceToken);\\n }\\n }\\n\\n /// @notice Uses an external swapper\\n /// @param swapper Contracts implementing the logic of the swap\\n /// @param inToken Token used to do the swap\\n /// @param outToken Token wanted\\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\\n /// @param inTokenObtained Amount of `inToken` used for the swap\\n /// @param data Additional info for the specific swapper\\n function _swapper(\\n ISwapper swapper,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) internal {\\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\\n }\\n\\n /// @notice Swaps an inToken to another token via 1Inch Router\\n /// @param payload Bytes needed for 1Inch router to process the swap\\n /// @dev The `payload` given is expected to be obtained from 1Inch API\\n function _swapOn1Inch(\\n IERC20 inToken,\\n uint256 minAmountOut,\\n bytes memory payload\\n ) internal returns (uint256 amountOut) {\\n // Approve transfer to the `oneInch` address\\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\\n address oneInchRouter = oneInch;\\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\\n //solhint-disable-next-line\\n (bool success, bytes memory result) = oneInchRouter.call(payload);\\n if (!success) _revertBytes(result);\\n\\n amountOut = abi.decode(result, (uint256));\\n _slippageCheck(amountOut, minAmountOut);\\n }\\n\\n /// @notice Mints `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to mint shares from\\n /// @param shares Amount of shares to mint from the contract\\n /// @param to Address to which shares should be sent\\n /// @param maxAmountIn Max amount of assets used to mint\\n /// @return amountIn Amount of assets used to mint by `to`\\n function _mint4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 maxAmountIn\\n ) internal returns (uint256 amountIn) {\\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\\n }\\n\\n /// @notice Deposits `amount` to an ERC4626 contract\\n /// @param savingsRate The ERC4626 to deposit assets to\\n /// @param amount Amount of assets to deposit\\n /// @param to Address to which shares should be sent\\n /// @param minSharesOut Minimum amount of shares that `to` should received\\n /// @return sharesOut Amount of shares received by `to`\\n function _deposit4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\\n }\\n\\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\\n function _deposit4626Referral(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) internal returns (uint256 sharesOut) {\\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\\n }\\n\\n /// @notice Withdraws `amount` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to withdraw assets from\\n /// @param amount Amount of assets to withdraw\\n /// @param to Destination of assets\\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\\n /// @return sharesOut Amount of shares burnt\\n function _withdraw4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 maxSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\\n }\\n\\n /// @notice Redeems `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to redeem shares from\\n /// @param shares Amount of shares to redeem\\n /// @param to Destination of assets\\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\\n /// @return amountOut Amount of assets received by `to`\\n function _redeem4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 minAmountOut\\n ) internal returns (uint256 amountOut) {\\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\\n }\\n\\n /// @notice Allows to perform some specific actions for a chain\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\\n\\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\\n\\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\\n\\n // ============================ GOVERNANCE FUNCTION ============================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Sets a new `core` contract\\n function setCore(ICoreBorrow _core) external {\\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\\n core = ICoreBorrow(_core);\\n }\\n\\n /// @notice Changes allowances for different tokens\\n /// @param tokens Addresses of the tokens to allow\\n /// @param spenders Addresses to allow transfer\\n /// @param amounts Amounts to allow\\n function changeAllowance(\\n IERC20[] calldata tokens,\\n address[] calldata spenders,\\n uint256[] calldata amounts\\n ) external onlyGovernorOrGuardian {\\n uint256 tokensLength = tokens.length;\\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\\n for (uint256 i; i < tokensLength; ++i) {\\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\\n }\\n }\\n\\n /// @notice Sets a new router variable\\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\\n if (router == address(0)) revert ZeroAddress();\\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\\n else oneInch = router;\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Changes allowance of this contract for a given token\\n /// @param token Address of the token to change allowance\\n /// @param spender Address to change the allowance of\\n /// @param amount Amount allowed\\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\\n } else if (currentAllowance > amount) {\\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\\n }\\n }\\n\\n /// @notice Transfer amount of the native token to the `to` address\\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\\n function _safeTransferNative(address to, uint256 amount) internal {\\n bool success;\\n //solhint-disable-next-line\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n if (!success) revert TransferFailed();\\n }\\n\\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\\n /// the calling address is well approved for all the vaults with which it is interacting\\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\\n /// with a vault are approved for this vault\\n function _parseVaultIDs(\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address vaultManager,\\n address collateral\\n ) internal view returns (bytes[] memory) {\\n uint256 actionsBorrowLength = actionsBorrow.length;\\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\\n bool createVaultAction;\\n uint256 lastVaultID;\\n uint256 vaultIDLength;\\n for (uint256 i; i < actionsBorrowLength; ++i) {\\n uint256 vaultID;\\n // If there is a `createVault` action, the router should not worry about looking at\\n // next vaultIDs given equal to 0\\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\\n createVaultAction = true;\\n continue;\\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\\n // as collateral the full contract balance\\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\\n uint256 amount;\\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\\n if (amount == type(uint256).max)\\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\\n continue;\\n // There are different ways depending on the action to find the `vaultID` to parse\\n } else if (\\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\\n ) {\\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\\n vaultID = abi.decode(dataBorrow[i], (uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\\n } else continue;\\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\\n // if there has not been any specific action\\n if (vaultID == 0) {\\n if (createVaultAction) {\\n continue;\\n } else {\\n // If we haven't stored the last `vaultID`, we need to fetch it\\n if (lastVaultID == 0) {\\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\\n }\\n vaultID = lastVaultID;\\n }\\n }\\n\\n // Check if this `vaultID` has already been verified\\n for (uint256 j; j < vaultIDLength; ++j) {\\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\\n // If yes, we continue to the next iteration\\n continue;\\n }\\n }\\n // Verify this new `vaultID` and add it to the list\\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\\n revert NotApprovedOrOwner();\\n }\\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\\n vaultIDLength += 1;\\n }\\n return dataBorrow;\\n }\\n\\n /// @notice Checks whether the amount obtained during a swap is not too small\\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\\n if (amount < thresholdAmount) revert TooSmallAmountOut();\\n }\\n\\n /// @notice Internal function used for error handling\\n function _revertBytes(bytes memory errMsg) internal pure {\\n if (errMsg.length != 0) {\\n //solhint-disable-next-line\\n assembly {\\n revert(add(32, errMsg), mload(errMsg))\\n }\\n }\\n revert InvalidReturnMessage();\\n }\\n}\\n\",\"keccak256\":\"0x5b45e51240ed42ae858c34a0e7e15003885bd998d3a47da7a4fa5604b69f5c2f\",\"license\":\"GPL-3.0\"},\"contracts/implementations/arbitrum/AngleRouterArbitrum.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"../../BaseRouter.sol\\\";\\n\\n/// @title AngleRouterArbitrum\\n/// @author Angle Core Team\\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\\ncontract AngleRouterArbitrum is BaseRouter {\\n /// @inheritdoc BaseRouter\\n function _getNativeWrapper() internal pure override returns (IWETH9) {\\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\\n }\\n}\\n\",\"keccak256\":\"0x5ecb90cb36a4d551bd4c28aefb1f8a1bf3f67b71728a419c66fcf933e55cbff9\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ICoreBorrow.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICoreBorrow\\n/// @author Angle Core Team\\n/// @notice Interface for the `CoreBorrow` contract\\n\\ninterface ICoreBorrow {\\n /// @notice Checks whether an address is governor of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2414539c445977b04bc7e9adac2e5147364994dd74e5d7118b44824956de602c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDepositWithReferral.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IDepositWithReferral\\n/// @author Angle Core Team\\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\\ninterface IDepositWithReferral {\\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\\n /// obtained, the function reverts\\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\\n /// when a deposit takes place\\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut);\\n}\\n\",\"keccak256\":\"0x69b88fa9ec5111394843f54f312c3b8c1b47490c76109a97ba90e4ac5697e960\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ILiquidityGauge.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface ILiquidityGauge {\\n // solhint-disable-next-line\\n function staking_token() external returns (address stakingToken);\\n\\n // solhint-disable-next-line\\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\\n\\n function deposit(\\n uint256 _value,\\n address _addr,\\n // solhint-disable-next-line\\n bool _claim_rewards\\n ) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr, address _receiver) external;\\n}\\n\",\"keccak256\":\"0x27144c21760603a4e441bb5eecf975ad7f71331ac0ba0a83352b280ccf734756\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\n/// @title ISwapper\\n/// @author Angle Core Team\\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\\ninterface ISwapper {\\n function swap(\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0x506f50d8447c2dc662bd844779cc66a407af07a91210612b956ef47abcc15776\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITreasury.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ITreasury\\n/// @author Angle Core Team\\n/// @notice Interface for the `Treasury` contract\\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\\n/// of this module\\ninterface ITreasury {\\n /// @notice Checks whether a given address has well been initialized in this contract\\n /// as a `VaultManager``\\n /// @param _vaultManager Address to check\\n /// @return Whether the address has been initialized or not\\n function isVaultManager(address _vaultManager) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x36bd50a0ab1c46503bb64b8d5777bf3b4fd2da0e2dcfe68c8a9702eb132eb3e2\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVaultManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./ITreasury.sol\\\";\\n\\n// ========================= Key Structs and Enums =============================\\n\\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\\n/// to the caller or associated addresses\\nstruct PaymentData {\\n // Stablecoin amount the contract should give\\n uint256 stablecoinAmountToGive;\\n // Stablecoin amount owed to the contract\\n uint256 stablecoinAmountToReceive;\\n // Collateral amount the contract should give\\n uint256 collateralAmountToGive;\\n // Collateral amount owed to the contract\\n uint256 collateralAmountToReceive;\\n}\\n\\n/// @notice Data stored to track someone's loan (or equivalently called position)\\nstruct Vault {\\n // Amount of collateral deposited in the vault\\n uint256 collateralAmount;\\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\\n uint256 normalizedDebt;\\n}\\n\\n/// @notice Actions possible when composing calls to the different entry functions proposed\\nenum ActionBorrowType {\\n createVault,\\n closeVault,\\n addCollateral,\\n removeCollateral,\\n repayDebt,\\n borrow,\\n getDebtIn,\\n permit\\n}\\n\\n// ========================= Interfaces =============================\\n\\n/// @title IVaultManagerFunctions\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface only contains functions of the contract which are called by other contracts\\n/// of this module (without getters)\\ninterface IVaultManagerFunctions {\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\\n /// @param repayData Data to pass to the repayment contract in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to,\\n address who,\\n bytes memory repayData\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Checks whether a given address is approved for a vault or owns this vault\\n /// @param spender Address for which vault ownership should be checked\\n /// @param vaultID ID of the vault to check\\n /// @return Whether the `spender` address owns or is approved for `vaultID`\\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\\n\\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\\n /// @param spender Address to give approval to\\n /// @param approved Whether to give or revoke the approval\\n /// @param deadline Deadline parameter for the signature to be valid\\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\\n function permit(\\n address owner,\\n address spender,\\n bool approved,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\\n/// @title IVaultManagerStorage\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface contains getters of the contract's public variables used by other contracts\\n/// of this module\\ninterface IVaultManagerStorage {\\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\\n function treasury() external view returns (ITreasury);\\n\\n /// @notice Reference to the collateral handled by this `VaultManager`\\n function collateral() external view returns (IERC20);\\n\\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\\n function vaultIDCount() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4cf6dc5e5b494165e4d9e524dca5c65f6307e5b005a62287c5e84f1539dc81f1\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title Interface for WETH9\\ninterface IWETH9 is IERC20 {\\n /// @notice Deposit ether to get wrapped ether\\n function deposit() external payable;\\n\\n /// @notice Withdraw wrapped ether to get ether\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0xb109c1d668416c05f61d6edea2ec7a10b2f8b386fd51a59cc12f929c73d00424\",\"license\":\"GPL-2.0-or-later\"},\"contracts/interfaces/external/uniswap/IUniswapRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nstruct ExactInputParams {\\n bytes path;\\n address recipient;\\n uint256 deadline;\\n uint256 amountIn;\\n uint256 amountOutMinimum;\\n}\\n\\n/// @title Router token swapping functionality\\n/// @notice Functions for swapping tokens via Uniswap V3\\ninterface IUniswapV3Router {\\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\\n /// @return amountOut The amount of the received token\\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\\n}\\n\\n/// @title Router for price estimation functionality\\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\\n/// @dev This interface is only used for non critical elements of the protocol\\ninterface IUniswapV2Router {\\n /// @notice Given an input asset amount, returns the maximum output amount of the\\n /// other asset (accounting for fees) given reserves.\\n /// @param path Addresses of the pools used to get prices\\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\\n\\n function swapExactTokensForTokens(\\n uint256 swapAmount,\\n uint256 minExpected,\\n address[] calldata path,\\n address receiver,\\n uint256 swapDeadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x1908fcdc6ff78ad2250f6ccacc7129df464a648cb2a5f376bedbe506d058bb73\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620018d51760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b613f52806200015c6000396000f3fe6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b60007382af49447d8a07e3bd95bd0d56f35241523fbab173ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b60007382af49447d8a07e3bd95bd0d56f35241523fbab16040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527382af49447d8a07e3bd95bd0d56f35241523fbab190632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220f7c04ed7e562f6e685977686fd5f3e26131a30c848644be2b4e5e7911773881064736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b60007382af49447d8a07e3bd95bd0d56f35241523fbab173ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b60007382af49447d8a07e3bd95bd0d56f35241523fbab16040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d000000000000000000000000000000000000000000000000000000008152600481018290527382af49447d8a07e3bd95bd0d56f35241523fbab190632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220f7c04ed7e562f6e685977686fd5f3e26131a30c848644be2b4e5e7911773881064736f6c63430008110033", + "devdoc": { + "author": "Angle Core Team", + "kind": "dev", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "params": { + "amounts": "Amounts to allow", + "spenders": "Addresses to allow transfer", + "tokens": "Addresses of the tokens to allow" + } + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens", + "params": { + "actions": "List of actions to be performed by the router (in order of execution)", + "data": "Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored", + "paramsPermit": "Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it" + } + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option", + "params": { + "paramsPermitVaultManager": "Parameters to sign permit to give allowance to the router for a `VaultManager` contract" + } + } + }, + "title": "AngleRouterArbitrum", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "notice": "Changes allowances for different tokens" + }, + "core()": { + "notice": "Core address handling access control" + }, + "deposit4626Referral(address,address,uint256,address,uint256,address)": { + "notice": "Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract" + }, + "initializeRouter(address,address,address)": { + "notice": "Deploys the router contract on a chain" + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Allows composable calls to different functions within the protocol" + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions" + }, + "oneInch()": { + "notice": "Address of 1Inch router used for swaps" + }, + "setCore(address)": { + "notice": "Sets a new `core` contract" + }, + "setRouter(address,uint8)": { + "notice": "Sets a new router variable" + }, + "uniswapV3Router()": { + "notice": "Address of the router used for swaps" + } + }, + "notice": "Router contract built specifially for Angle use cases on Arbitrum", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6, + "contract": "contracts/implementations/arbitrum/AngleRouterArbitrum.sol:AngleRouterArbitrum", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 9, + "contract": "contracts/implementations/arbitrum/AngleRouterArbitrum.sol:AngleRouterArbitrum", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 1478, + "contract": "contracts/implementations/arbitrum/AngleRouterArbitrum.sol:AngleRouterArbitrum", + "label": "core", + "offset": 2, + "slot": "0", + "type": "t_contract(ICoreBorrow)3793" + }, + { + "astId": 1482, + "contract": "contracts/implementations/arbitrum/AngleRouterArbitrum.sol:AngleRouterArbitrum", + "label": "uniswapV3Router", + "offset": 0, + "slot": "1", + "type": "t_contract(IUniswapV3Router)4262" + }, + { + "astId": 1485, + "contract": "contracts/implementations/arbitrum/AngleRouterArbitrum.sol:AngleRouterArbitrum", + "label": "oneInch", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 1489, + "contract": "contracts/implementations/arbitrum/AngleRouterArbitrum.sol:AngleRouterArbitrum", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint256)47_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ICoreBorrow)3793": { + "encoding": "inplace", + "label": "contract ICoreBorrow", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Router)4262": { + "encoding": "inplace", + "label": "contract IUniswapV3Router", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/arbitrum/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json b/deployments/arbitrum/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json new file mode 100644 index 0000000..c75418b --- /dev/null +++ b/deployments/arbitrum/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json @@ -0,0 +1,142 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\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 IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\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 require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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 */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\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. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/BaseRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport \"./interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./interfaces/external/IWETH9.sol\";\nimport \"./interfaces/ICoreBorrow.sol\";\nimport \"./interfaces/IDepositWithReferral.sol\";\nimport \"./interfaces/ILiquidityGauge.sol\";\nimport \"./interfaces/ISwapper.sol\";\nimport \"./interfaces/IVaultManager.sol\";\n\n// ============================== STRUCTS AND ENUM =============================\n\n/// @notice Action types\nenum ActionType {\n transfer,\n wrapNative,\n unwrapNative,\n sweep,\n sweepNative,\n // Deprecated\n uniswapV3,\n oneInch,\n claimRewards,\n // Deprecated\n gaugeDeposit,\n borrower,\n swapper,\n mint4626,\n deposit4626,\n redeem4626,\n withdraw4626,\n // Deprecated\n prepareRedeemSavingsRate,\n // Deprecated\n claimRedeemSavingsRate,\n // Deprecated\n swapIn,\n // Deprecated\n swapOut,\n claimWeeklyInterest,\n // Deprecated\n withdraw,\n // Deprecated\n mint,\n // Deprecated\n deposit,\n // Deprecated\n openPerpetual,\n // Deprecated\n addToPerpetual,\n veANGLEDeposit,\n // Deprecated\n claimRewardsWithPerps,\n deposit4626Referral\n}\n\n/// @notice Data needed to get permits\nstruct PermitType {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @notice Data to grant permit to the router for a vault\nstruct PermitVaultManagerType {\n address vaultManager;\n address owner;\n bool approved;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @title BaseRouter\n/// @author Angle Core Team\n/// @notice Base contract that Angle router contracts on different chains should override\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\n using SafeERC20 for IERC20;\n\n // ================================= REFERENCES ================================\n\n /// @notice Core address handling access control\n ICoreBorrow public core;\n /// @notice Address of the router used for swaps\n IUniswapV3Router public uniswapV3Router;\n /// @notice Address of 1Inch router used for swaps\n address public oneInch;\n\n uint256[47] private __gap;\n\n // ============================== EVENTS / ERRORS ==============================\n\n error IncompatibleLengths();\n error InvalidReturnMessage();\n error NotApprovedOrOwner();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error TooSmallAmountOut();\n error TransferFailed();\n error ZeroAddress();\n\n event ReferredDeposit(\n address caller,\n address indexed owner,\n uint256 assets,\n uint256 shares,\n address indexed savings,\n address indexed referrer\n );\n\n /// @notice Deploys the router contract on a chain\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\n if (_core == address(0)) revert ZeroAddress();\n core = ICoreBorrow(_core);\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\n oneInch = _oneInch;\n }\n\n constructor() initializer {}\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @notice Allows composable calls to different functions within the protocol\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\n /// @param actions List of actions to be performed by the router (in order of execution)\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\n /// for a given action are stored\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\n /// do not perform a sweep action on these tokens\n function mixer(\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) public payable virtual {\n // If all tokens have already been approved, there's no need for this step\n uint256 permitsLength = paramsPermit.length;\n for (uint256 i; i < permitsLength; ++i) {\n IERC20Permit(paramsPermit[i].token).permit(\n paramsPermit[i].owner,\n address(this),\n paramsPermit[i].value,\n paramsPermit[i].deadline,\n paramsPermit[i].v,\n paramsPermit[i].r,\n paramsPermit[i].s\n );\n }\n // Performing actions one after the others\n uint256 actionsLength = actions.length;\n for (uint256 i; i < actionsLength; ++i) {\n if (actions[i] == ActionType.transfer) {\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\n } else if (actions[i] == ActionType.wrapNative) {\n _wrapNative();\n } else if (actions[i] == ActionType.unwrapNative) {\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\n _unwrapNative(minAmountOut, to);\n } else if (actions[i] == ActionType.sweep) {\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\n _sweep(tokenOut, minAmountOut, to);\n } else if (actions[i] == ActionType.sweepNative) {\n uint256 routerBalance = address(this).balance;\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\n } else if (actions[i] == ActionType.oneInch) {\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\n data[i],\n (address, uint256, bytes)\n );\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\n } else if (actions[i] == ActionType.claimRewards) {\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\n _claimRewards(user, claimLiquidityGauges);\n } else if (actions[i] == ActionType.borrower) {\n (\n address collateral,\n address vaultManager,\n address to,\n address who,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n bytes memory repayData\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\n } else if (actions[i] == ActionType.swapper) {\n (\n ISwapper swapperContract,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory payload\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\n } else if (actions[i] == ActionType.mint4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _mint4626(savingsRate, shares, to, maxAmountIn);\n } else if (actions[i] == ActionType.deposit4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626(savingsRate, amount, to, minSharesOut);\n } else if (actions[i] == ActionType.deposit4626Referral) {\n (\n IERC20 token,\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\n } else if (actions[i] == ActionType.redeem4626) {\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _redeem4626(savingsRate, shares, to, minAmountOut);\n } else if (actions[i] == ActionType.withdraw4626) {\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\n } else {\n _chainSpecificAction(actions[i], data[i]);\n }\n }\n }\n\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\n /// addresses depositing from a certain referring address into an ERC4626 contract\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n _changeAllowance(IERC20(token), savings, type(uint256).max);\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\n }\n\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\n /// actions and then revoking this approval after these actions\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\n /// to revoke approvals\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\n /// is just an option\n function mixerVaultManagerPermit(\n PermitVaultManagerType[] memory paramsPermitVaultManager,\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) external payable virtual {\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n true,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n } else break;\n }\n mixer(paramsPermit, actions, data);\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\n // too deep\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (!paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n false,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n }\n }\n }\n\n receive() external payable {}\n\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\n\n /// @notice Wraps the native token of a chain to its wrapped version\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\n /// @dev The amount to wrap is to be specified in the `msg.value`\n function _wrapNative() internal virtual returns (uint256) {\n _getNativeWrapper().deposit{ value: msg.value }();\n return msg.value;\n }\n\n /// @notice Unwraps the wrapped version of a token to the native chain token\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\n amount = _getNativeWrapper().balanceOf(address(this));\n _slippageCheck(amount, minAmountOut);\n if (amount != 0) {\n _getNativeWrapper().withdraw(amount);\n _safeTransferNative(to, amount);\n }\n return amount;\n }\n\n /// @notice Internal version of the `claimRewards` function\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\n uint256 gaugesLength = liquidityGauges.length;\n for (uint256 i; i < gaugesLength; ++i) {\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\n }\n }\n\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\n /// @param vaultManager Address of the vault to perform actions on\n /// @param actionsBorrow Actions type to perform on the vaultManager\n /// @param dataBorrow Data needed for each actions\n /// @param to Address to send the funds to\n /// @param who Swapper address to handle repayments\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\n function _angleBorrower(\n address vaultManager,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address to,\n address who,\n bytes memory repayData\n ) internal virtual returns (PaymentData memory paymentData) {\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\n }\n\n /// @notice Sweeps tokens from the router contract\n /// @param tokenOut Token to sweep\n /// @param minAmountOut Minimum amount of tokens to recover\n /// @param to Address to which tokens should be sent\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\n _slippageCheck(balanceToken, minAmountOut);\n if (balanceToken != 0) {\n IERC20(tokenOut).safeTransfer(to, balanceToken);\n }\n }\n\n /// @notice Uses an external swapper\n /// @param swapper Contracts implementing the logic of the swap\n /// @param inToken Token used to do the swap\n /// @param outToken Token wanted\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\n /// @param inTokenObtained Amount of `inToken` used for the swap\n /// @param data Additional info for the specific swapper\n function _swapper(\n ISwapper swapper,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) internal {\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\n }\n\n /// @notice Swaps an inToken to another token via 1Inch Router\n /// @param payload Bytes needed for 1Inch router to process the swap\n /// @dev The `payload` given is expected to be obtained from 1Inch API\n function _swapOn1Inch(\n IERC20 inToken,\n uint256 minAmountOut,\n bytes memory payload\n ) internal returns (uint256 amountOut) {\n // Approve transfer to the `oneInch` address\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\n address oneInchRouter = oneInch;\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\n //solhint-disable-next-line\n (bool success, bytes memory result) = oneInchRouter.call(payload);\n if (!success) _revertBytes(result);\n\n amountOut = abi.decode(result, (uint256));\n _slippageCheck(amountOut, minAmountOut);\n }\n\n /// @notice Mints `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to mint shares from\n /// @param shares Amount of shares to mint from the contract\n /// @param to Address to which shares should be sent\n /// @param maxAmountIn Max amount of assets used to mint\n /// @return amountIn Amount of assets used to mint by `to`\n function _mint4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 maxAmountIn\n ) internal returns (uint256 amountIn) {\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\n }\n\n /// @notice Deposits `amount` to an ERC4626 contract\n /// @param savingsRate The ERC4626 to deposit assets to\n /// @param amount Amount of assets to deposit\n /// @param to Address to which shares should be sent\n /// @param minSharesOut Minimum amount of shares that `to` should received\n /// @return sharesOut Amount of shares received by `to`\n function _deposit4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\n }\n\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\n function _deposit4626Referral(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) internal returns (uint256 sharesOut) {\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\n }\n\n /// @notice Withdraws `amount` from an ERC4626 contract\n /// @param savingsRate ERC4626 to withdraw assets from\n /// @param amount Amount of assets to withdraw\n /// @param to Destination of assets\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\n /// @return sharesOut Amount of shares burnt\n function _withdraw4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 maxSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\n }\n\n /// @notice Redeems `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to redeem shares from\n /// @param shares Amount of shares to redeem\n /// @param to Destination of assets\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\n /// @return amountOut Amount of assets received by `to`\n function _redeem4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 minAmountOut\n ) internal returns (uint256 amountOut) {\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\n }\n\n /// @notice Allows to perform some specific actions for a chain\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\n\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\n\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\n\n // ============================ GOVERNANCE FUNCTION ============================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Sets a new `core` contract\n function setCore(ICoreBorrow _core) external {\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\n core = ICoreBorrow(_core);\n }\n\n /// @notice Changes allowances for different tokens\n /// @param tokens Addresses of the tokens to allow\n /// @param spenders Addresses to allow transfer\n /// @param amounts Amounts to allow\n function changeAllowance(\n IERC20[] calldata tokens,\n address[] calldata spenders,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\n for (uint256 i; i < tokensLength; ++i) {\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\n }\n }\n\n /// @notice Sets a new router variable\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\n if (router == address(0)) revert ZeroAddress();\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\n else oneInch = router;\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Changes allowance of this contract for a given token\n /// @param token Address of the token to change allowance\n /// @param spender Address to change the allowance of\n /// @param amount Amount allowed\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\n uint256 currentAllowance = token.allowance(address(this), spender);\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\n } else if (currentAllowance > amount) {\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\n }\n }\n\n /// @notice Transfer amount of the native token to the `to` address\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\n function _safeTransferNative(address to, uint256 amount) internal {\n bool success;\n //solhint-disable-next-line\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) revert TransferFailed();\n }\n\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\n /// the calling address is well approved for all the vaults with which it is interacting\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\n /// with a vault are approved for this vault\n function _parseVaultIDs(\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address vaultManager,\n address collateral\n ) internal view returns (bytes[] memory) {\n uint256 actionsBorrowLength = actionsBorrow.length;\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\n bool createVaultAction;\n uint256 lastVaultID;\n uint256 vaultIDLength;\n for (uint256 i; i < actionsBorrowLength; ++i) {\n uint256 vaultID;\n // If there is a `createVault` action, the router should not worry about looking at\n // next vaultIDs given equal to 0\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\n createVaultAction = true;\n continue;\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\n // as collateral the full contract balance\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\n uint256 amount;\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\n if (amount == type(uint256).max)\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\n continue;\n // There are different ways depending on the action to find the `vaultID` to parse\n } else if (\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\n ) {\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\n vaultID = abi.decode(dataBorrow[i], (uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\n } else continue;\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\n // if there has not been any specific action\n if (vaultID == 0) {\n if (createVaultAction) {\n continue;\n } else {\n // If we haven't stored the last `vaultID`, we need to fetch it\n if (lastVaultID == 0) {\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\n }\n vaultID = lastVaultID;\n }\n }\n\n // Check if this `vaultID` has already been verified\n for (uint256 j; j < vaultIDLength; ++j) {\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\n // If yes, we continue to the next iteration\n continue;\n }\n }\n // Verify this new `vaultID` and add it to the list\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\n revert NotApprovedOrOwner();\n }\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\n vaultIDLength += 1;\n }\n return dataBorrow;\n }\n\n /// @notice Checks whether the amount obtained during a swap is not too small\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\n if (amount < thresholdAmount) revert TooSmallAmountOut();\n }\n\n /// @notice Internal function used for error handling\n function _revertBytes(bytes memory errMsg) internal pure {\n if (errMsg.length != 0) {\n //solhint-disable-next-line\n assembly {\n revert(add(32, errMsg), mload(errMsg))\n }\n }\n revert InvalidReturnMessage();\n }\n}\n" + }, + "contracts/implementations/arbitrum/AngleRouterArbitrum.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterArbitrum\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\ncontract AngleRouterArbitrum is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n }\n}\n" + }, + "contracts/implementations/avalanche/AngleRouterAvalanche.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterAvalanche\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Avalanche\ncontract AngleRouterAvalanche is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n }\n}\n" + }, + "contracts/implementations/base/AngleRouterBase.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterBase\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Base\ncontract AngleRouterBase is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/celo/AngleRouterCelo.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterCelo\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Celo\ncontract AngleRouterCelo is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0000000000000000000000000000000000000000);\n }\n}\n" + }, + "contracts/implementations/gnosis/AngleRouterGnosis.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterGnosis\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Gnosis\ncontract AngleRouterGnosis is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n }\n}\n" + }, + "contracts/implementations/mainnet/AngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../interfaces/IFeeDistributorFront.sol\";\nimport \"../../interfaces/ISanToken.sol\";\nimport \"../../interfaces/IStableMasterFront.sol\";\nimport \"../../interfaces/IVeANGLE.sol\";\n\nimport \"../../BaseRouter.sol\";\n\n// ============================= STRUCTS AND ENUMS =============================\n\n/// @notice References to the contracts associated to a collateral for a stablecoin\nstruct Pairs {\n IPoolManager poolManager;\n IPerpetualManagerFrontWithClaim perpetualManager;\n ISanToken sanToken;\n ILiquidityGauge gauge;\n}\n\n/// @title AngleRouterMainnet\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Ethereum\n/// @dev Previous implementation with an initialization function can be found here:\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\ncontract AngleRouterMainnet is BaseRouter {\n using SafeERC20 for IERC20;\n\n // =================================== ERRORS ==================================\n\n error InvalidParams();\n\n // ================================== MAPPINGS =================================\n\n /// @notice Maps an agToken to its counterpart `StableMaster`\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\n\n uint256[48] private __gapMainnet;\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @inheritdoc BaseRouter\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\n if (action == ActionType.claimWeeklyInterest) {\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\n } else if (action == ActionType.veANGLEDeposit) {\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\n _depositOnLocker(user, amount);\n }\n }\n\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n }\n\n /// @notice Deposits ANGLE on an existing locker\n /// @param user Address to deposit for\n /// @param amount Amount to deposit\n function _depositOnLocker(address user, uint256 amount) internal {\n _getVeANGLE().deposit_for(user, amount);\n }\n\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\n /// @param user Address to claim for\n /// @param _feeDistributor Address of the fee distributor to claim to\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\n /// transfer the token claimed from the `feeDistributor`\n function _claimWeeklyInterest(\n address user,\n IFeeDistributorFront _feeDistributor,\n bool letInContract\n ) internal {\n uint256 amount = _feeDistributor.claim(user);\n if (letInContract) {\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\n IERC20 token = IERC20(_feeDistributor.token());\n token.safeTransferFrom(msg.sender, address(this), amount);\n }\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Returns the veANGLE address\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\n }\n}\n" + }, + "contracts/implementations/optimism/AngleRouterOptimism.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterOptimism\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Optimism\ncontract AngleRouterOptimism is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/polygon/AngleRouterPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterPolygon\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Polygon\ncontract AngleRouterPolygon is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n }\n}\n" + }, + "contracts/interfaces/external/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nstruct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n}\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IUniswapV3Router {\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n\n/// @title Router for price estimation functionality\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\n/// @dev This interface is only used for non critical elements of the protocol\ninterface IUniswapV2Router {\n /// @notice Given an input asset amount, returns the maximum output amount of the\n /// other asset (accounting for fees) given reserves.\n /// @param path Addresses of the pools used to get prices\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokens(\n uint256 swapAmount,\n uint256 minExpected,\n address[] calldata path,\n address receiver,\n uint256 swapDeadline\n ) external;\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICoreBorrow\n/// @author Angle Core Team\n/// @notice Interface for the `CoreBorrow` contract\n\ninterface ICoreBorrow {\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IDepositWithReferral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title IDepositWithReferral\n/// @author Angle Core Team\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\ninterface IDepositWithReferral {\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\n /// obtained, the function reverts\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\n /// when a deposit takes place\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut);\n}\n" + }, + "contracts/interfaces/IFeeDistributorFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IFeeDistributorFront\n/// @author Interface for public use of the `FeeDistributor` contract\n/// @dev This interface is used for user related function\ninterface IFeeDistributorFront {\n function token() external returns (address);\n\n function claim(address _addr) external returns (uint256);\n\n function claim(address[20] memory _addr) external returns (bool);\n}\n" + }, + "contracts/interfaces/ILiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function staking_token() external returns (address stakingToken);\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external;\n}\n" + }, + "contracts/interfaces/IPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title Interface of the contract managing perpetuals with claim function\n/// @author Angle Core Team\n/// @dev Front interface with rewards function, meaning only user-facing functions\ninterface IPerpetualManagerFrontWithClaim {\n function getReward(uint256 perpetualID) external;\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\n\n function openPerpetual(\n address owner,\n uint256 amountBrought,\n uint256 amountCommitted,\n uint256 maxOracleRate,\n uint256 minNetMargin\n ) external returns (uint256 perpetualID);\n}\n" + }, + "contracts/interfaces/IPoolManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IPoolManager {\n function token() external view returns (address);\n}\n" + }, + "contracts/interfaces/ISanToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ISanToken is IERC20Upgradeable {}\n" + }, + "contracts/interfaces/IStableMasterFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IPoolManager.sol\";\nimport \"./ISanToken.sol\";\nimport \"./IPerpetualManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Struct to handle all the parameters to manage the fees\n// related to a given collateral pool (associated to the stablecoin)\nstruct MintBurnData {\n // Values of the thresholds to compute the minting fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeMint;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeMint;\n // Values of the thresholds to compute the burning fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeBurn;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeBurn;\n // Max proportion of collateral from users that can be covered by HAs\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\n // the other changes accordingly\n uint64 targetHAHedge;\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusMint;\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusBurn;\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\n uint256 capOnStableMinted;\n}\n\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\n// including the fraction of interests they receive or the fees to be distributed to\n// them\nstruct SLPData {\n // Last timestamp at which the `sanRate` has been updated for SLPs\n uint256 lastBlockUpdated;\n // Fees accumulated from previous blocks and to be distributed to SLPs\n uint256 lockedInterests;\n // Max interests used to update the `sanRate` in a single block\n // Should be in collateral token base\n uint256 maxInterestsDistributed;\n // Amount of fees left aside for SLPs and that will be distributed\n // when the protocol is collateralized back again\n uint256 feesAside;\n // Part of the fees normally going to SLPs that is left aside\n // before the protocol is collateralized back again (depends on collateral ratio)\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippageFee;\n // Portion of the fees from users minting and burning\n // that goes to SLPs (the rest goes to surplus)\n uint64 feesForSLPs;\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippage;\n // Portion of the interests from lending\n // that goes to SLPs (the rest goes to surplus)\n uint64 interestsForSLPs;\n}\n\n/// @title IStableMasterFront\n/// @author Angle Core Team\n/// @dev Front interface, meaning only user-facing functions\ninterface IStableMasterFront {\n function collateralMap(IPoolManager poolManager)\n external\n view\n returns (\n IERC20 token,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n address oracle,\n uint256 stocksUsers,\n uint256 sanRate,\n uint256 collatBase,\n SLPData memory slpData,\n MintBurnData memory feeData\n );\n\n function updateStocksUsers(uint256 amount, address poolManager) external;\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256 minStableAmount\n ) external;\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256 minCollatAmount\n ) external;\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external;\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external;\n\n function agToken() external returns (address);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Core Team\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\ninterface ISwapper {\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager``\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\n uint256 normalizedDebt;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionBorrowType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IVeANGLE\n/// @author Angle Core Team\n/// @notice Interface for the `VeANGLE` contract\ninterface IVeANGLE {\n // solhint-disable-next-line func-name-mixedcase\n function deposit_for(address addr, uint256 amount) external;\n}\n" + }, + "contracts/mock/MockAngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../implementations/mainnet/AngleRouterMainnet.sol\";\n\ncontract MockAngleRouterMainnet is AngleRouterMainnet {\n address public veAngle;\n\n function setAngleAndVeANGLE(address _veAngle) external {\n veAngle = _veAngle;\n }\n\n function _getVeANGLE() internal view override returns (IVeANGLE) {\n return IVeANGLE(veAngle);\n }\n\n function addStableMaster(IERC20 stablecoin, IStableMasterFront stableMaster) external {\n mapStableMasters[stablecoin] = stableMaster;\n }\n\n function addPairs(\n IERC20[] calldata stablecoins,\n IPoolManager[] calldata poolManagers,\n ILiquidityGauge[] calldata liquidityGauges,\n bool[] calldata justLiquidityGauges\n ) external {\n for (uint256 i; i < stablecoins.length; ++i) {\n IStableMasterFront stableMaster = mapStableMasters[stablecoins[i]];\n _addPair(stableMaster, poolManagers[i], liquidityGauges[i], justLiquidityGauges[i]);\n }\n }\n\n function _addPair(\n IStableMasterFront stableMaster,\n IPoolManager poolManager,\n ILiquidityGauge liquidityGauge,\n bool justLiquidityGauge\n ) internal {\n // Fetching the associated `sanToken` and `perpetualManager` from the contract\n (\n IERC20 collateral,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n ,\n ,\n ,\n ,\n ,\n\n ) = stableMaster.collateralMap(poolManager);\n // Reverting if the poolManager is not a valid `poolManager`\n if (address(collateral) == address(0)) revert InvalidParams();\n Pairs storage _pairs = mapPoolManagers[stableMaster][collateral];\n if (justLiquidityGauge) {\n // Cannot specify a liquidity gauge if the associated poolManager does not exist\n if (address(_pairs.poolManager) == address(0)) revert ZeroAddress();\n ILiquidityGauge gauge = _pairs.gauge;\n if (address(gauge) != address(0)) {\n _changeAllowance(IERC20(address(sanToken)), address(gauge), 0);\n }\n } else {\n // Checking if the pair has not already been initialized: if yes we need to make the function revert\n // otherwise we could end up with still approved `PoolManager` and `PerpetualManager` contracts\n if (address(_pairs.poolManager) != address(0)) revert InvalidParams();\n _pairs.poolManager = poolManager;\n _pairs.perpetualManager = IPerpetualManagerFrontWithClaim(address(perpetualManager));\n _pairs.sanToken = sanToken;\n _changeAllowance(collateral, address(stableMaster), type(uint256).max);\n _changeAllowance(collateral, address(perpetualManager), type(uint256).max);\n }\n _pairs.gauge = liquidityGauge;\n if (address(liquidityGauge) != address(0)) {\n if (address(sanToken) != liquidityGauge.staking_token()) revert InvalidParams();\n _changeAllowance(IERC20(address(sanToken)), address(liquidityGauge), type(uint256).max);\n }\n }\n}\n\ncontract MockAngleRouterMainnet2 is AngleRouterMainnet {\n function getVeANGLE() external view returns (IVeANGLE) {\n return _getVeANGLE();\n }\n}\n" + }, + "contracts/mock/MockRouterSidechain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/external/IWETH9.sol\";\n\nimport \"../BaseRouter.sol\";\n\n/// @title MockRouterSidechain\n/// @author Angle Core Team\n/// @notice Mock contract but built for tests as if to be deployed on Ethereum\ncontract MockRouterSidechain is BaseRouter {\n IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function _wrapNative() internal pure override returns (uint256) {\n return 0;\n }\n\n function _unwrapNative(uint256, address) internal pure override returns (uint256 amount) {\n return 0;\n }\n\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return WETH;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/avalanche/AngleRouterAvalancheV3_0_Implementation.json b/deployments/avalanche/AngleRouterAvalancheV3_0_Implementation.json new file mode 100644 index 0000000..65eecd1 --- /dev/null +++ b/deployments/avalanche/AngleRouterAvalancheV3_0_Implementation.json @@ -0,0 +1,618 @@ +{ + "address": "0x05225a6416EDaeeC7227027E86F7A47D18A06b91", + "abi": [ + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReturnMessage", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferredDeposit", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "spenders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "changeAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit4626Referral", + "outputs": [ + { + "internalType": "uint256", + "name": "sharesOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_uniswapRouter", + "type": "address" + }, + { + "internalType": "address", + "name": "_oneInch", + "type": "address" + } + ], + "name": "initializeRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vaultManager", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitVaultManagerType[]", + "name": "paramsPermitVaultManager", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixerVaultManagerPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "oneInch", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "_core", + "type": "address" + } + ], + "name": "setCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "internalType": "uint8", + "name": "who", + "type": "uint8" + } + ], + "name": "setRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "uniswapV3Router", + "outputs": [ + { + "internalType": "contract IUniswapV3Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x6e8d4e19d7d58935e4da91d4e24b2af691536e0a2fca8f296d03aa4362de8854", + "receipt": { + "to": null, + "from": "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701", + "contractAddress": "0x05225a6416EDaeeC7227027E86F7A47D18A06b91", + "transactionIndex": 2, + "gasUsed": "3564890", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0a1af651902471e888ac198b70188806c31098bbea39835201279fc1b3a3bf8d", + "transactionHash": "0x6e8d4e19d7d58935e4da91d4e24b2af691536e0a2fca8f296d03aa4362de8854", + "logs": [ + { + "transactionIndex": 2, + "blockNumber": 45380351, + "transactionHash": "0x6e8d4e19d7d58935e4da91d4e24b2af691536e0a2fca8f296d03aa4362de8854", + "address": "0x05225a6416EDaeeC7227027E86F7A47D18A06b91", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 1, + "blockHash": "0x0a1af651902471e888ac198b70188806c31098bbea39835201279fc1b3a3bf8d" + } + ], + "blockNumber": 45380351, + "cumulativeGasUsed": "3673432", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0d1b1c94fd2e1964436c8b9a0e25c545", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReturnMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApprovedOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferredDeposit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"spenders\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"changeAllowance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minSharesOut\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"deposit4626Referral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sharesOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_uniswapRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oneInch\",\"type\":\"address\"}],\"name\":\"initializeRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"vaultManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitVaultManagerType[]\",\"name\":\"paramsPermitVaultManager\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixerVaultManagerPermit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oneInch\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"setCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"who\",\"type\":\"uint8\"}],\"name\":\"setRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV3Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Router\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"params\":{\"amounts\":\"Amounts to allow\",\"spenders\":\"Addresses to allow transfer\",\"tokens\":\"Addresses of the tokens to allow\"}},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens\",\"params\":{\"actions\":\"List of actions to be performed by the router (in order of execution)\",\"data\":\"Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored\",\"paramsPermit\":\"Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\"}},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option\",\"params\":{\"paramsPermitVaultManager\":\"Parameters to sign permit to give allowance to the router for a `VaultManager` contract\"}}},\"title\":\"AngleRouterAvalanche\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"notice\":\"Changes allowances for different tokens\"},\"core()\":{\"notice\":\"Core address handling access control\"},\"deposit4626Referral(address,address,uint256,address,uint256,address)\":{\"notice\":\"Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract\"},\"initializeRouter(address,address,address)\":{\"notice\":\"Deploys the router contract on a chain\"},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Allows composable calls to different functions within the protocol\"},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions\"},\"oneInch()\":{\"notice\":\"Address of 1Inch router used for swaps\"},\"setCore(address)\":{\"notice\":\"Sets a new `core` contract\"},\"setRouter(address,uint8)\":{\"notice\":\"Sets a new router variable\"},\"uniswapV3Router()\":{\"notice\":\"Address of the router used for swaps\"}},\"notice\":\"Router contract built specifially for Angle use cases on Avalanche\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/implementations/avalanche/AngleRouterAvalanche.sol\":\"AngleRouterAvalanche\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x9750c6fec736eb3320e85924f36a3060fa4a4ab1758d06d9585e175d164eefdb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\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 IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\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 require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\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 */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\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. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"contracts/BaseRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport \\\"./interfaces/external/uniswap/IUniswapRouter.sol\\\";\\nimport \\\"./interfaces/external/IWETH9.sol\\\";\\nimport \\\"./interfaces/ICoreBorrow.sol\\\";\\nimport \\\"./interfaces/IDepositWithReferral.sol\\\";\\nimport \\\"./interfaces/ILiquidityGauge.sol\\\";\\nimport \\\"./interfaces/ISwapper.sol\\\";\\nimport \\\"./interfaces/IVaultManager.sol\\\";\\n\\n// ============================== STRUCTS AND ENUM =============================\\n\\n/// @notice Action types\\nenum ActionType {\\n transfer,\\n wrapNative,\\n unwrapNative,\\n sweep,\\n sweepNative,\\n // Deprecated\\n uniswapV3,\\n oneInch,\\n claimRewards,\\n // Deprecated\\n gaugeDeposit,\\n borrower,\\n swapper,\\n mint4626,\\n deposit4626,\\n redeem4626,\\n withdraw4626,\\n // Deprecated\\n prepareRedeemSavingsRate,\\n // Deprecated\\n claimRedeemSavingsRate,\\n // Deprecated\\n swapIn,\\n // Deprecated\\n swapOut,\\n claimWeeklyInterest,\\n // Deprecated\\n withdraw,\\n // Deprecated\\n mint,\\n // Deprecated\\n deposit,\\n // Deprecated\\n openPerpetual,\\n // Deprecated\\n addToPerpetual,\\n veANGLEDeposit,\\n // Deprecated\\n claimRewardsWithPerps,\\n deposit4626Referral\\n}\\n\\n/// @notice Data needed to get permits\\nstruct PermitType {\\n address token;\\n address owner;\\n uint256 value;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @notice Data to grant permit to the router for a vault\\nstruct PermitVaultManagerType {\\n address vaultManager;\\n address owner;\\n bool approved;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @title BaseRouter\\n/// @author Angle Core Team\\n/// @notice Base contract that Angle router contracts on different chains should override\\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\\n using SafeERC20 for IERC20;\\n\\n // ================================= REFERENCES ================================\\n\\n /// @notice Core address handling access control\\n ICoreBorrow public core;\\n /// @notice Address of the router used for swaps\\n IUniswapV3Router public uniswapV3Router;\\n /// @notice Address of 1Inch router used for swaps\\n address public oneInch;\\n\\n uint256[47] private __gap;\\n\\n // ============================== EVENTS / ERRORS ==============================\\n\\n error IncompatibleLengths();\\n error InvalidReturnMessage();\\n error NotApprovedOrOwner();\\n error NotGovernor();\\n error NotGovernorOrGuardian();\\n error TooSmallAmountOut();\\n error TransferFailed();\\n error ZeroAddress();\\n\\n event ReferredDeposit(\\n address caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares,\\n address indexed savings,\\n address indexed referrer\\n );\\n\\n /// @notice Deploys the router contract on a chain\\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\\n if (_core == address(0)) revert ZeroAddress();\\n core = ICoreBorrow(_core);\\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\\n oneInch = _oneInch;\\n }\\n\\n constructor() initializer {}\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @notice Allows composable calls to different functions within the protocol\\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\\n /// @param actions List of actions to be performed by the router (in order of execution)\\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\\n /// for a given action are stored\\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\\n /// do not perform a sweep action on these tokens\\n function mixer(\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) public payable virtual {\\n // If all tokens have already been approved, there's no need for this step\\n uint256 permitsLength = paramsPermit.length;\\n for (uint256 i; i < permitsLength; ++i) {\\n IERC20Permit(paramsPermit[i].token).permit(\\n paramsPermit[i].owner,\\n address(this),\\n paramsPermit[i].value,\\n paramsPermit[i].deadline,\\n paramsPermit[i].v,\\n paramsPermit[i].r,\\n paramsPermit[i].s\\n );\\n }\\n // Performing actions one after the others\\n uint256 actionsLength = actions.length;\\n for (uint256 i; i < actionsLength; ++i) {\\n if (actions[i] == ActionType.transfer) {\\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\\n } else if (actions[i] == ActionType.wrapNative) {\\n _wrapNative();\\n } else if (actions[i] == ActionType.unwrapNative) {\\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\\n _unwrapNative(minAmountOut, to);\\n } else if (actions[i] == ActionType.sweep) {\\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\\n _sweep(tokenOut, minAmountOut, to);\\n } else if (actions[i] == ActionType.sweepNative) {\\n uint256 routerBalance = address(this).balance;\\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\\n } else if (actions[i] == ActionType.oneInch) {\\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\\n data[i],\\n (address, uint256, bytes)\\n );\\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\\n } else if (actions[i] == ActionType.claimRewards) {\\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\\n _claimRewards(user, claimLiquidityGauges);\\n } else if (actions[i] == ActionType.borrower) {\\n (\\n address collateral,\\n address vaultManager,\\n address to,\\n address who,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n bytes memory repayData\\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\\n } else if (actions[i] == ActionType.swapper) {\\n (\\n ISwapper swapperContract,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory payload\\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\\n } else if (actions[i] == ActionType.mint4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _mint4626(savingsRate, shares, to, maxAmountIn);\\n } else if (actions[i] == ActionType.deposit4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626(savingsRate, amount, to, minSharesOut);\\n } else if (actions[i] == ActionType.deposit4626Referral) {\\n (\\n IERC20 token,\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\\n } else if (actions[i] == ActionType.redeem4626) {\\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _redeem4626(savingsRate, shares, to, minAmountOut);\\n } else if (actions[i] == ActionType.withdraw4626) {\\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\\n } else {\\n _chainSpecificAction(actions[i], data[i]);\\n }\\n }\\n }\\n\\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\\n /// addresses depositing from a certain referring address into an ERC4626 contract\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut) {\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n _changeAllowance(IERC20(token), savings, type(uint256).max);\\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\\n }\\n\\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\\n /// actions and then revoking this approval after these actions\\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\\n /// to revoke approvals\\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\\n /// is just an option\\n function mixerVaultManagerPermit(\\n PermitVaultManagerType[] memory paramsPermitVaultManager,\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) external payable virtual {\\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n true,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n } else break;\\n }\\n mixer(paramsPermit, actions, data);\\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\\n // too deep\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (!paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n false,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n }\\n }\\n }\\n\\n receive() external payable {}\\n\\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\\n\\n /// @notice Wraps the native token of a chain to its wrapped version\\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\\n /// @dev The amount to wrap is to be specified in the `msg.value`\\n function _wrapNative() internal virtual returns (uint256) {\\n _getNativeWrapper().deposit{ value: msg.value }();\\n return msg.value;\\n }\\n\\n /// @notice Unwraps the wrapped version of a token to the native chain token\\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\\n amount = _getNativeWrapper().balanceOf(address(this));\\n _slippageCheck(amount, minAmountOut);\\n if (amount != 0) {\\n _getNativeWrapper().withdraw(amount);\\n _safeTransferNative(to, amount);\\n }\\n return amount;\\n }\\n\\n /// @notice Internal version of the `claimRewards` function\\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\\n uint256 gaugesLength = liquidityGauges.length;\\n for (uint256 i; i < gaugesLength; ++i) {\\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\\n }\\n }\\n\\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\\n /// @param vaultManager Address of the vault to perform actions on\\n /// @param actionsBorrow Actions type to perform on the vaultManager\\n /// @param dataBorrow Data needed for each actions\\n /// @param to Address to send the funds to\\n /// @param who Swapper address to handle repayments\\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\\n function _angleBorrower(\\n address vaultManager,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address to,\\n address who,\\n bytes memory repayData\\n ) internal virtual returns (PaymentData memory paymentData) {\\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\\n }\\n\\n /// @notice Sweeps tokens from the router contract\\n /// @param tokenOut Token to sweep\\n /// @param minAmountOut Minimum amount of tokens to recover\\n /// @param to Address to which tokens should be sent\\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\\n _slippageCheck(balanceToken, minAmountOut);\\n if (balanceToken != 0) {\\n IERC20(tokenOut).safeTransfer(to, balanceToken);\\n }\\n }\\n\\n /// @notice Uses an external swapper\\n /// @param swapper Contracts implementing the logic of the swap\\n /// @param inToken Token used to do the swap\\n /// @param outToken Token wanted\\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\\n /// @param inTokenObtained Amount of `inToken` used for the swap\\n /// @param data Additional info for the specific swapper\\n function _swapper(\\n ISwapper swapper,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) internal {\\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\\n }\\n\\n /// @notice Swaps an inToken to another token via 1Inch Router\\n /// @param payload Bytes needed for 1Inch router to process the swap\\n /// @dev The `payload` given is expected to be obtained from 1Inch API\\n function _swapOn1Inch(\\n IERC20 inToken,\\n uint256 minAmountOut,\\n bytes memory payload\\n ) internal returns (uint256 amountOut) {\\n // Approve transfer to the `oneInch` address\\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\\n address oneInchRouter = oneInch;\\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\\n //solhint-disable-next-line\\n (bool success, bytes memory result) = oneInchRouter.call(payload);\\n if (!success) _revertBytes(result);\\n\\n amountOut = abi.decode(result, (uint256));\\n _slippageCheck(amountOut, minAmountOut);\\n }\\n\\n /// @notice Mints `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to mint shares from\\n /// @param shares Amount of shares to mint from the contract\\n /// @param to Address to which shares should be sent\\n /// @param maxAmountIn Max amount of assets used to mint\\n /// @return amountIn Amount of assets used to mint by `to`\\n function _mint4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 maxAmountIn\\n ) internal returns (uint256 amountIn) {\\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\\n }\\n\\n /// @notice Deposits `amount` to an ERC4626 contract\\n /// @param savingsRate The ERC4626 to deposit assets to\\n /// @param amount Amount of assets to deposit\\n /// @param to Address to which shares should be sent\\n /// @param minSharesOut Minimum amount of shares that `to` should received\\n /// @return sharesOut Amount of shares received by `to`\\n function _deposit4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\\n }\\n\\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\\n function _deposit4626Referral(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) internal returns (uint256 sharesOut) {\\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\\n }\\n\\n /// @notice Withdraws `amount` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to withdraw assets from\\n /// @param amount Amount of assets to withdraw\\n /// @param to Destination of assets\\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\\n /// @return sharesOut Amount of shares burnt\\n function _withdraw4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 maxSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\\n }\\n\\n /// @notice Redeems `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to redeem shares from\\n /// @param shares Amount of shares to redeem\\n /// @param to Destination of assets\\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\\n /// @return amountOut Amount of assets received by `to`\\n function _redeem4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 minAmountOut\\n ) internal returns (uint256 amountOut) {\\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\\n }\\n\\n /// @notice Allows to perform some specific actions for a chain\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\\n\\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\\n\\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\\n\\n // ============================ GOVERNANCE FUNCTION ============================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Sets a new `core` contract\\n function setCore(ICoreBorrow _core) external {\\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\\n core = ICoreBorrow(_core);\\n }\\n\\n /// @notice Changes allowances for different tokens\\n /// @param tokens Addresses of the tokens to allow\\n /// @param spenders Addresses to allow transfer\\n /// @param amounts Amounts to allow\\n function changeAllowance(\\n IERC20[] calldata tokens,\\n address[] calldata spenders,\\n uint256[] calldata amounts\\n ) external onlyGovernorOrGuardian {\\n uint256 tokensLength = tokens.length;\\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\\n for (uint256 i; i < tokensLength; ++i) {\\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\\n }\\n }\\n\\n /// @notice Sets a new router variable\\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\\n if (router == address(0)) revert ZeroAddress();\\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\\n else oneInch = router;\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Changes allowance of this contract for a given token\\n /// @param token Address of the token to change allowance\\n /// @param spender Address to change the allowance of\\n /// @param amount Amount allowed\\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\\n } else if (currentAllowance > amount) {\\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\\n }\\n }\\n\\n /// @notice Transfer amount of the native token to the `to` address\\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\\n function _safeTransferNative(address to, uint256 amount) internal {\\n bool success;\\n //solhint-disable-next-line\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n if (!success) revert TransferFailed();\\n }\\n\\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\\n /// the calling address is well approved for all the vaults with which it is interacting\\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\\n /// with a vault are approved for this vault\\n function _parseVaultIDs(\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address vaultManager,\\n address collateral\\n ) internal view returns (bytes[] memory) {\\n uint256 actionsBorrowLength = actionsBorrow.length;\\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\\n bool createVaultAction;\\n uint256 lastVaultID;\\n uint256 vaultIDLength;\\n for (uint256 i; i < actionsBorrowLength; ++i) {\\n uint256 vaultID;\\n // If there is a `createVault` action, the router should not worry about looking at\\n // next vaultIDs given equal to 0\\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\\n createVaultAction = true;\\n continue;\\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\\n // as collateral the full contract balance\\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\\n uint256 amount;\\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\\n if (amount == type(uint256).max)\\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\\n continue;\\n // There are different ways depending on the action to find the `vaultID` to parse\\n } else if (\\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\\n ) {\\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\\n vaultID = abi.decode(dataBorrow[i], (uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\\n } else continue;\\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\\n // if there has not been any specific action\\n if (vaultID == 0) {\\n if (createVaultAction) {\\n continue;\\n } else {\\n // If we haven't stored the last `vaultID`, we need to fetch it\\n if (lastVaultID == 0) {\\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\\n }\\n vaultID = lastVaultID;\\n }\\n }\\n\\n // Check if this `vaultID` has already been verified\\n for (uint256 j; j < vaultIDLength; ++j) {\\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\\n // If yes, we continue to the next iteration\\n continue;\\n }\\n }\\n // Verify this new `vaultID` and add it to the list\\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\\n revert NotApprovedOrOwner();\\n }\\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\\n vaultIDLength += 1;\\n }\\n return dataBorrow;\\n }\\n\\n /// @notice Checks whether the amount obtained during a swap is not too small\\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\\n if (amount < thresholdAmount) revert TooSmallAmountOut();\\n }\\n\\n /// @notice Internal function used for error handling\\n function _revertBytes(bytes memory errMsg) internal pure {\\n if (errMsg.length != 0) {\\n //solhint-disable-next-line\\n assembly {\\n revert(add(32, errMsg), mload(errMsg))\\n }\\n }\\n revert InvalidReturnMessage();\\n }\\n}\\n\",\"keccak256\":\"0x5b45e51240ed42ae858c34a0e7e15003885bd998d3a47da7a4fa5604b69f5c2f\",\"license\":\"GPL-3.0\"},\"contracts/implementations/avalanche/AngleRouterAvalanche.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"../../BaseRouter.sol\\\";\\n\\n/// @title AngleRouterAvalanche\\n/// @author Angle Core Team\\n/// @notice Router contract built specifially for Angle use cases on Avalanche\\ncontract AngleRouterAvalanche is BaseRouter {\\n /// @inheritdoc BaseRouter\\n function _getNativeWrapper() internal pure override returns (IWETH9) {\\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\\n }\\n}\\n\",\"keccak256\":\"0x8d5fa4e0dc6e27d03ce515a62b19ebf5d15e9386f34296ff3cb2c8aa6f933819\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ICoreBorrow.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICoreBorrow\\n/// @author Angle Core Team\\n/// @notice Interface for the `CoreBorrow` contract\\n\\ninterface ICoreBorrow {\\n /// @notice Checks whether an address is governor of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2414539c445977b04bc7e9adac2e5147364994dd74e5d7118b44824956de602c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDepositWithReferral.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IDepositWithReferral\\n/// @author Angle Core Team\\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\\ninterface IDepositWithReferral {\\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\\n /// obtained, the function reverts\\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\\n /// when a deposit takes place\\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut);\\n}\\n\",\"keccak256\":\"0x69b88fa9ec5111394843f54f312c3b8c1b47490c76109a97ba90e4ac5697e960\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ILiquidityGauge.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface ILiquidityGauge {\\n // solhint-disable-next-line\\n function staking_token() external returns (address stakingToken);\\n\\n // solhint-disable-next-line\\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\\n\\n function deposit(\\n uint256 _value,\\n address _addr,\\n // solhint-disable-next-line\\n bool _claim_rewards\\n ) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr, address _receiver) external;\\n}\\n\",\"keccak256\":\"0x27144c21760603a4e441bb5eecf975ad7f71331ac0ba0a83352b280ccf734756\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\n/// @title ISwapper\\n/// @author Angle Core Team\\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\\ninterface ISwapper {\\n function swap(\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0x506f50d8447c2dc662bd844779cc66a407af07a91210612b956ef47abcc15776\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITreasury.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ITreasury\\n/// @author Angle Core Team\\n/// @notice Interface for the `Treasury` contract\\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\\n/// of this module\\ninterface ITreasury {\\n /// @notice Checks whether a given address has well been initialized in this contract\\n /// as a `VaultManager``\\n /// @param _vaultManager Address to check\\n /// @return Whether the address has been initialized or not\\n function isVaultManager(address _vaultManager) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x36bd50a0ab1c46503bb64b8d5777bf3b4fd2da0e2dcfe68c8a9702eb132eb3e2\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVaultManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./ITreasury.sol\\\";\\n\\n// ========================= Key Structs and Enums =============================\\n\\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\\n/// to the caller or associated addresses\\nstruct PaymentData {\\n // Stablecoin amount the contract should give\\n uint256 stablecoinAmountToGive;\\n // Stablecoin amount owed to the contract\\n uint256 stablecoinAmountToReceive;\\n // Collateral amount the contract should give\\n uint256 collateralAmountToGive;\\n // Collateral amount owed to the contract\\n uint256 collateralAmountToReceive;\\n}\\n\\n/// @notice Data stored to track someone's loan (or equivalently called position)\\nstruct Vault {\\n // Amount of collateral deposited in the vault\\n uint256 collateralAmount;\\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\\n uint256 normalizedDebt;\\n}\\n\\n/// @notice Actions possible when composing calls to the different entry functions proposed\\nenum ActionBorrowType {\\n createVault,\\n closeVault,\\n addCollateral,\\n removeCollateral,\\n repayDebt,\\n borrow,\\n getDebtIn,\\n permit\\n}\\n\\n// ========================= Interfaces =============================\\n\\n/// @title IVaultManagerFunctions\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface only contains functions of the contract which are called by other contracts\\n/// of this module (without getters)\\ninterface IVaultManagerFunctions {\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\\n /// @param repayData Data to pass to the repayment contract in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to,\\n address who,\\n bytes memory repayData\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Checks whether a given address is approved for a vault or owns this vault\\n /// @param spender Address for which vault ownership should be checked\\n /// @param vaultID ID of the vault to check\\n /// @return Whether the `spender` address owns or is approved for `vaultID`\\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\\n\\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\\n /// @param spender Address to give approval to\\n /// @param approved Whether to give or revoke the approval\\n /// @param deadline Deadline parameter for the signature to be valid\\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\\n function permit(\\n address owner,\\n address spender,\\n bool approved,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\\n/// @title IVaultManagerStorage\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface contains getters of the contract's public variables used by other contracts\\n/// of this module\\ninterface IVaultManagerStorage {\\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\\n function treasury() external view returns (ITreasury);\\n\\n /// @notice Reference to the collateral handled by this `VaultManager`\\n function collateral() external view returns (IERC20);\\n\\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\\n function vaultIDCount() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4cf6dc5e5b494165e4d9e524dca5c65f6307e5b005a62287c5e84f1539dc81f1\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title Interface for WETH9\\ninterface IWETH9 is IERC20 {\\n /// @notice Deposit ether to get wrapped ether\\n function deposit() external payable;\\n\\n /// @notice Withdraw wrapped ether to get ether\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0xb109c1d668416c05f61d6edea2ec7a10b2f8b386fd51a59cc12f929c73d00424\",\"license\":\"GPL-2.0-or-later\"},\"contracts/interfaces/external/uniswap/IUniswapRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nstruct ExactInputParams {\\n bytes path;\\n address recipient;\\n uint256 deadline;\\n uint256 amountIn;\\n uint256 amountOutMinimum;\\n}\\n\\n/// @title Router token swapping functionality\\n/// @notice Functions for swapping tokens via Uniswap V3\\ninterface IUniswapV3Router {\\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\\n /// @return amountOut The amount of the received token\\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\\n}\\n\\n/// @title Router for price estimation functionality\\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\\n/// @dev This interface is only used for non critical elements of the protocol\\ninterface IUniswapV2Router {\\n /// @notice Given an input asset amount, returns the maximum output amount of the\\n /// other asset (accounting for fees) given reserves.\\n /// @param path Addresses of the pools used to get prices\\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\\n\\n function swapExactTokensForTokens(\\n uint256 swapAmount,\\n uint256 minExpected,\\n address[] calldata path,\\n address receiver,\\n uint256 swapDeadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x1908fcdc6ff78ad2250f6ccacc7129df464a648cb2a5f376bedbe506d058bb73\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620018d51760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b613f52806200015c6000396000f3fe6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073b31f66aa3c1e785363f0875a1b74e27b85fd66c773ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b600073b31f66aa3c1e785363f0875a1b74e27b85fd66c76040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273b31f66aa3c1e785363f0875a1b74e27b85fd66c790632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220942b7a6122aacf98ece12d665178fb910a1ddbf213077fd2fb57c7eb50569ea264736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073b31f66aa3c1e785363f0875a1b74e27b85fd66c773ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b600073b31f66aa3c1e785363f0875a1b74e27b85fd66c76040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273b31f66aa3c1e785363f0875a1b74e27b85fd66c790632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220942b7a6122aacf98ece12d665178fb910a1ddbf213077fd2fb57c7eb50569ea264736f6c63430008110033", + "devdoc": { + "author": "Angle Core Team", + "kind": "dev", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "params": { + "amounts": "Amounts to allow", + "spenders": "Addresses to allow transfer", + "tokens": "Addresses of the tokens to allow" + } + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens", + "params": { + "actions": "List of actions to be performed by the router (in order of execution)", + "data": "Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored", + "paramsPermit": "Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it" + } + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option", + "params": { + "paramsPermitVaultManager": "Parameters to sign permit to give allowance to the router for a `VaultManager` contract" + } + } + }, + "title": "AngleRouterAvalanche", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "notice": "Changes allowances for different tokens" + }, + "core()": { + "notice": "Core address handling access control" + }, + "deposit4626Referral(address,address,uint256,address,uint256,address)": { + "notice": "Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract" + }, + "initializeRouter(address,address,address)": { + "notice": "Deploys the router contract on a chain" + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Allows composable calls to different functions within the protocol" + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions" + }, + "oneInch()": { + "notice": "Address of 1Inch router used for swaps" + }, + "setCore(address)": { + "notice": "Sets a new `core` contract" + }, + "setRouter(address,uint8)": { + "notice": "Sets a new router variable" + }, + "uniswapV3Router()": { + "notice": "Address of the router used for swaps" + } + }, + "notice": "Router contract built specifially for Angle use cases on Avalanche", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6, + "contract": "contracts/implementations/avalanche/AngleRouterAvalanche.sol:AngleRouterAvalanche", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 9, + "contract": "contracts/implementations/avalanche/AngleRouterAvalanche.sol:AngleRouterAvalanche", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 1478, + "contract": "contracts/implementations/avalanche/AngleRouterAvalanche.sol:AngleRouterAvalanche", + "label": "core", + "offset": 2, + "slot": "0", + "type": "t_contract(ICoreBorrow)3793" + }, + { + "astId": 1482, + "contract": "contracts/implementations/avalanche/AngleRouterAvalanche.sol:AngleRouterAvalanche", + "label": "uniswapV3Router", + "offset": 0, + "slot": "1", + "type": "t_contract(IUniswapV3Router)4262" + }, + { + "astId": 1485, + "contract": "contracts/implementations/avalanche/AngleRouterAvalanche.sol:AngleRouterAvalanche", + "label": "oneInch", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 1489, + "contract": "contracts/implementations/avalanche/AngleRouterAvalanche.sol:AngleRouterAvalanche", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint256)47_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ICoreBorrow)3793": { + "encoding": "inplace", + "label": "contract ICoreBorrow", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Router)4262": { + "encoding": "inplace", + "label": "contract IUniswapV3Router", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/avalanche/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json b/deployments/avalanche/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json new file mode 100644 index 0000000..c75418b --- /dev/null +++ b/deployments/avalanche/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json @@ -0,0 +1,142 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\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 IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\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 require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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 */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\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. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/BaseRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport \"./interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./interfaces/external/IWETH9.sol\";\nimport \"./interfaces/ICoreBorrow.sol\";\nimport \"./interfaces/IDepositWithReferral.sol\";\nimport \"./interfaces/ILiquidityGauge.sol\";\nimport \"./interfaces/ISwapper.sol\";\nimport \"./interfaces/IVaultManager.sol\";\n\n// ============================== STRUCTS AND ENUM =============================\n\n/// @notice Action types\nenum ActionType {\n transfer,\n wrapNative,\n unwrapNative,\n sweep,\n sweepNative,\n // Deprecated\n uniswapV3,\n oneInch,\n claimRewards,\n // Deprecated\n gaugeDeposit,\n borrower,\n swapper,\n mint4626,\n deposit4626,\n redeem4626,\n withdraw4626,\n // Deprecated\n prepareRedeemSavingsRate,\n // Deprecated\n claimRedeemSavingsRate,\n // Deprecated\n swapIn,\n // Deprecated\n swapOut,\n claimWeeklyInterest,\n // Deprecated\n withdraw,\n // Deprecated\n mint,\n // Deprecated\n deposit,\n // Deprecated\n openPerpetual,\n // Deprecated\n addToPerpetual,\n veANGLEDeposit,\n // Deprecated\n claimRewardsWithPerps,\n deposit4626Referral\n}\n\n/// @notice Data needed to get permits\nstruct PermitType {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @notice Data to grant permit to the router for a vault\nstruct PermitVaultManagerType {\n address vaultManager;\n address owner;\n bool approved;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @title BaseRouter\n/// @author Angle Core Team\n/// @notice Base contract that Angle router contracts on different chains should override\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\n using SafeERC20 for IERC20;\n\n // ================================= REFERENCES ================================\n\n /// @notice Core address handling access control\n ICoreBorrow public core;\n /// @notice Address of the router used for swaps\n IUniswapV3Router public uniswapV3Router;\n /// @notice Address of 1Inch router used for swaps\n address public oneInch;\n\n uint256[47] private __gap;\n\n // ============================== EVENTS / ERRORS ==============================\n\n error IncompatibleLengths();\n error InvalidReturnMessage();\n error NotApprovedOrOwner();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error TooSmallAmountOut();\n error TransferFailed();\n error ZeroAddress();\n\n event ReferredDeposit(\n address caller,\n address indexed owner,\n uint256 assets,\n uint256 shares,\n address indexed savings,\n address indexed referrer\n );\n\n /// @notice Deploys the router contract on a chain\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\n if (_core == address(0)) revert ZeroAddress();\n core = ICoreBorrow(_core);\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\n oneInch = _oneInch;\n }\n\n constructor() initializer {}\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @notice Allows composable calls to different functions within the protocol\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\n /// @param actions List of actions to be performed by the router (in order of execution)\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\n /// for a given action are stored\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\n /// do not perform a sweep action on these tokens\n function mixer(\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) public payable virtual {\n // If all tokens have already been approved, there's no need for this step\n uint256 permitsLength = paramsPermit.length;\n for (uint256 i; i < permitsLength; ++i) {\n IERC20Permit(paramsPermit[i].token).permit(\n paramsPermit[i].owner,\n address(this),\n paramsPermit[i].value,\n paramsPermit[i].deadline,\n paramsPermit[i].v,\n paramsPermit[i].r,\n paramsPermit[i].s\n );\n }\n // Performing actions one after the others\n uint256 actionsLength = actions.length;\n for (uint256 i; i < actionsLength; ++i) {\n if (actions[i] == ActionType.transfer) {\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\n } else if (actions[i] == ActionType.wrapNative) {\n _wrapNative();\n } else if (actions[i] == ActionType.unwrapNative) {\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\n _unwrapNative(minAmountOut, to);\n } else if (actions[i] == ActionType.sweep) {\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\n _sweep(tokenOut, minAmountOut, to);\n } else if (actions[i] == ActionType.sweepNative) {\n uint256 routerBalance = address(this).balance;\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\n } else if (actions[i] == ActionType.oneInch) {\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\n data[i],\n (address, uint256, bytes)\n );\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\n } else if (actions[i] == ActionType.claimRewards) {\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\n _claimRewards(user, claimLiquidityGauges);\n } else if (actions[i] == ActionType.borrower) {\n (\n address collateral,\n address vaultManager,\n address to,\n address who,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n bytes memory repayData\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\n } else if (actions[i] == ActionType.swapper) {\n (\n ISwapper swapperContract,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory payload\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\n } else if (actions[i] == ActionType.mint4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _mint4626(savingsRate, shares, to, maxAmountIn);\n } else if (actions[i] == ActionType.deposit4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626(savingsRate, amount, to, minSharesOut);\n } else if (actions[i] == ActionType.deposit4626Referral) {\n (\n IERC20 token,\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\n } else if (actions[i] == ActionType.redeem4626) {\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _redeem4626(savingsRate, shares, to, minAmountOut);\n } else if (actions[i] == ActionType.withdraw4626) {\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\n } else {\n _chainSpecificAction(actions[i], data[i]);\n }\n }\n }\n\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\n /// addresses depositing from a certain referring address into an ERC4626 contract\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n _changeAllowance(IERC20(token), savings, type(uint256).max);\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\n }\n\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\n /// actions and then revoking this approval after these actions\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\n /// to revoke approvals\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\n /// is just an option\n function mixerVaultManagerPermit(\n PermitVaultManagerType[] memory paramsPermitVaultManager,\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) external payable virtual {\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n true,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n } else break;\n }\n mixer(paramsPermit, actions, data);\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\n // too deep\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (!paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n false,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n }\n }\n }\n\n receive() external payable {}\n\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\n\n /// @notice Wraps the native token of a chain to its wrapped version\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\n /// @dev The amount to wrap is to be specified in the `msg.value`\n function _wrapNative() internal virtual returns (uint256) {\n _getNativeWrapper().deposit{ value: msg.value }();\n return msg.value;\n }\n\n /// @notice Unwraps the wrapped version of a token to the native chain token\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\n amount = _getNativeWrapper().balanceOf(address(this));\n _slippageCheck(amount, minAmountOut);\n if (amount != 0) {\n _getNativeWrapper().withdraw(amount);\n _safeTransferNative(to, amount);\n }\n return amount;\n }\n\n /// @notice Internal version of the `claimRewards` function\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\n uint256 gaugesLength = liquidityGauges.length;\n for (uint256 i; i < gaugesLength; ++i) {\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\n }\n }\n\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\n /// @param vaultManager Address of the vault to perform actions on\n /// @param actionsBorrow Actions type to perform on the vaultManager\n /// @param dataBorrow Data needed for each actions\n /// @param to Address to send the funds to\n /// @param who Swapper address to handle repayments\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\n function _angleBorrower(\n address vaultManager,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address to,\n address who,\n bytes memory repayData\n ) internal virtual returns (PaymentData memory paymentData) {\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\n }\n\n /// @notice Sweeps tokens from the router contract\n /// @param tokenOut Token to sweep\n /// @param minAmountOut Minimum amount of tokens to recover\n /// @param to Address to which tokens should be sent\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\n _slippageCheck(balanceToken, minAmountOut);\n if (balanceToken != 0) {\n IERC20(tokenOut).safeTransfer(to, balanceToken);\n }\n }\n\n /// @notice Uses an external swapper\n /// @param swapper Contracts implementing the logic of the swap\n /// @param inToken Token used to do the swap\n /// @param outToken Token wanted\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\n /// @param inTokenObtained Amount of `inToken` used for the swap\n /// @param data Additional info for the specific swapper\n function _swapper(\n ISwapper swapper,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) internal {\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\n }\n\n /// @notice Swaps an inToken to another token via 1Inch Router\n /// @param payload Bytes needed for 1Inch router to process the swap\n /// @dev The `payload` given is expected to be obtained from 1Inch API\n function _swapOn1Inch(\n IERC20 inToken,\n uint256 minAmountOut,\n bytes memory payload\n ) internal returns (uint256 amountOut) {\n // Approve transfer to the `oneInch` address\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\n address oneInchRouter = oneInch;\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\n //solhint-disable-next-line\n (bool success, bytes memory result) = oneInchRouter.call(payload);\n if (!success) _revertBytes(result);\n\n amountOut = abi.decode(result, (uint256));\n _slippageCheck(amountOut, minAmountOut);\n }\n\n /// @notice Mints `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to mint shares from\n /// @param shares Amount of shares to mint from the contract\n /// @param to Address to which shares should be sent\n /// @param maxAmountIn Max amount of assets used to mint\n /// @return amountIn Amount of assets used to mint by `to`\n function _mint4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 maxAmountIn\n ) internal returns (uint256 amountIn) {\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\n }\n\n /// @notice Deposits `amount` to an ERC4626 contract\n /// @param savingsRate The ERC4626 to deposit assets to\n /// @param amount Amount of assets to deposit\n /// @param to Address to which shares should be sent\n /// @param minSharesOut Minimum amount of shares that `to` should received\n /// @return sharesOut Amount of shares received by `to`\n function _deposit4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\n }\n\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\n function _deposit4626Referral(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) internal returns (uint256 sharesOut) {\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\n }\n\n /// @notice Withdraws `amount` from an ERC4626 contract\n /// @param savingsRate ERC4626 to withdraw assets from\n /// @param amount Amount of assets to withdraw\n /// @param to Destination of assets\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\n /// @return sharesOut Amount of shares burnt\n function _withdraw4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 maxSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\n }\n\n /// @notice Redeems `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to redeem shares from\n /// @param shares Amount of shares to redeem\n /// @param to Destination of assets\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\n /// @return amountOut Amount of assets received by `to`\n function _redeem4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 minAmountOut\n ) internal returns (uint256 amountOut) {\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\n }\n\n /// @notice Allows to perform some specific actions for a chain\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\n\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\n\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\n\n // ============================ GOVERNANCE FUNCTION ============================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Sets a new `core` contract\n function setCore(ICoreBorrow _core) external {\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\n core = ICoreBorrow(_core);\n }\n\n /// @notice Changes allowances for different tokens\n /// @param tokens Addresses of the tokens to allow\n /// @param spenders Addresses to allow transfer\n /// @param amounts Amounts to allow\n function changeAllowance(\n IERC20[] calldata tokens,\n address[] calldata spenders,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\n for (uint256 i; i < tokensLength; ++i) {\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\n }\n }\n\n /// @notice Sets a new router variable\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\n if (router == address(0)) revert ZeroAddress();\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\n else oneInch = router;\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Changes allowance of this contract for a given token\n /// @param token Address of the token to change allowance\n /// @param spender Address to change the allowance of\n /// @param amount Amount allowed\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\n uint256 currentAllowance = token.allowance(address(this), spender);\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\n } else if (currentAllowance > amount) {\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\n }\n }\n\n /// @notice Transfer amount of the native token to the `to` address\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\n function _safeTransferNative(address to, uint256 amount) internal {\n bool success;\n //solhint-disable-next-line\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) revert TransferFailed();\n }\n\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\n /// the calling address is well approved for all the vaults with which it is interacting\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\n /// with a vault are approved for this vault\n function _parseVaultIDs(\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address vaultManager,\n address collateral\n ) internal view returns (bytes[] memory) {\n uint256 actionsBorrowLength = actionsBorrow.length;\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\n bool createVaultAction;\n uint256 lastVaultID;\n uint256 vaultIDLength;\n for (uint256 i; i < actionsBorrowLength; ++i) {\n uint256 vaultID;\n // If there is a `createVault` action, the router should not worry about looking at\n // next vaultIDs given equal to 0\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\n createVaultAction = true;\n continue;\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\n // as collateral the full contract balance\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\n uint256 amount;\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\n if (amount == type(uint256).max)\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\n continue;\n // There are different ways depending on the action to find the `vaultID` to parse\n } else if (\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\n ) {\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\n vaultID = abi.decode(dataBorrow[i], (uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\n } else continue;\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\n // if there has not been any specific action\n if (vaultID == 0) {\n if (createVaultAction) {\n continue;\n } else {\n // If we haven't stored the last `vaultID`, we need to fetch it\n if (lastVaultID == 0) {\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\n }\n vaultID = lastVaultID;\n }\n }\n\n // Check if this `vaultID` has already been verified\n for (uint256 j; j < vaultIDLength; ++j) {\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\n // If yes, we continue to the next iteration\n continue;\n }\n }\n // Verify this new `vaultID` and add it to the list\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\n revert NotApprovedOrOwner();\n }\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\n vaultIDLength += 1;\n }\n return dataBorrow;\n }\n\n /// @notice Checks whether the amount obtained during a swap is not too small\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\n if (amount < thresholdAmount) revert TooSmallAmountOut();\n }\n\n /// @notice Internal function used for error handling\n function _revertBytes(bytes memory errMsg) internal pure {\n if (errMsg.length != 0) {\n //solhint-disable-next-line\n assembly {\n revert(add(32, errMsg), mload(errMsg))\n }\n }\n revert InvalidReturnMessage();\n }\n}\n" + }, + "contracts/implementations/arbitrum/AngleRouterArbitrum.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterArbitrum\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\ncontract AngleRouterArbitrum is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n }\n}\n" + }, + "contracts/implementations/avalanche/AngleRouterAvalanche.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterAvalanche\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Avalanche\ncontract AngleRouterAvalanche is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n }\n}\n" + }, + "contracts/implementations/base/AngleRouterBase.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterBase\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Base\ncontract AngleRouterBase is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/celo/AngleRouterCelo.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterCelo\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Celo\ncontract AngleRouterCelo is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0000000000000000000000000000000000000000);\n }\n}\n" + }, + "contracts/implementations/gnosis/AngleRouterGnosis.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterGnosis\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Gnosis\ncontract AngleRouterGnosis is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n }\n}\n" + }, + "contracts/implementations/mainnet/AngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../interfaces/IFeeDistributorFront.sol\";\nimport \"../../interfaces/ISanToken.sol\";\nimport \"../../interfaces/IStableMasterFront.sol\";\nimport \"../../interfaces/IVeANGLE.sol\";\n\nimport \"../../BaseRouter.sol\";\n\n// ============================= STRUCTS AND ENUMS =============================\n\n/// @notice References to the contracts associated to a collateral for a stablecoin\nstruct Pairs {\n IPoolManager poolManager;\n IPerpetualManagerFrontWithClaim perpetualManager;\n ISanToken sanToken;\n ILiquidityGauge gauge;\n}\n\n/// @title AngleRouterMainnet\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Ethereum\n/// @dev Previous implementation with an initialization function can be found here:\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\ncontract AngleRouterMainnet is BaseRouter {\n using SafeERC20 for IERC20;\n\n // =================================== ERRORS ==================================\n\n error InvalidParams();\n\n // ================================== MAPPINGS =================================\n\n /// @notice Maps an agToken to its counterpart `StableMaster`\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\n\n uint256[48] private __gapMainnet;\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @inheritdoc BaseRouter\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\n if (action == ActionType.claimWeeklyInterest) {\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\n } else if (action == ActionType.veANGLEDeposit) {\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\n _depositOnLocker(user, amount);\n }\n }\n\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n }\n\n /// @notice Deposits ANGLE on an existing locker\n /// @param user Address to deposit for\n /// @param amount Amount to deposit\n function _depositOnLocker(address user, uint256 amount) internal {\n _getVeANGLE().deposit_for(user, amount);\n }\n\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\n /// @param user Address to claim for\n /// @param _feeDistributor Address of the fee distributor to claim to\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\n /// transfer the token claimed from the `feeDistributor`\n function _claimWeeklyInterest(\n address user,\n IFeeDistributorFront _feeDistributor,\n bool letInContract\n ) internal {\n uint256 amount = _feeDistributor.claim(user);\n if (letInContract) {\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\n IERC20 token = IERC20(_feeDistributor.token());\n token.safeTransferFrom(msg.sender, address(this), amount);\n }\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Returns the veANGLE address\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\n }\n}\n" + }, + "contracts/implementations/optimism/AngleRouterOptimism.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterOptimism\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Optimism\ncontract AngleRouterOptimism is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/polygon/AngleRouterPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterPolygon\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Polygon\ncontract AngleRouterPolygon is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n }\n}\n" + }, + "contracts/interfaces/external/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nstruct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n}\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IUniswapV3Router {\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n\n/// @title Router for price estimation functionality\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\n/// @dev This interface is only used for non critical elements of the protocol\ninterface IUniswapV2Router {\n /// @notice Given an input asset amount, returns the maximum output amount of the\n /// other asset (accounting for fees) given reserves.\n /// @param path Addresses of the pools used to get prices\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokens(\n uint256 swapAmount,\n uint256 minExpected,\n address[] calldata path,\n address receiver,\n uint256 swapDeadline\n ) external;\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICoreBorrow\n/// @author Angle Core Team\n/// @notice Interface for the `CoreBorrow` contract\n\ninterface ICoreBorrow {\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IDepositWithReferral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title IDepositWithReferral\n/// @author Angle Core Team\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\ninterface IDepositWithReferral {\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\n /// obtained, the function reverts\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\n /// when a deposit takes place\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut);\n}\n" + }, + "contracts/interfaces/IFeeDistributorFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IFeeDistributorFront\n/// @author Interface for public use of the `FeeDistributor` contract\n/// @dev This interface is used for user related function\ninterface IFeeDistributorFront {\n function token() external returns (address);\n\n function claim(address _addr) external returns (uint256);\n\n function claim(address[20] memory _addr) external returns (bool);\n}\n" + }, + "contracts/interfaces/ILiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function staking_token() external returns (address stakingToken);\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external;\n}\n" + }, + "contracts/interfaces/IPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title Interface of the contract managing perpetuals with claim function\n/// @author Angle Core Team\n/// @dev Front interface with rewards function, meaning only user-facing functions\ninterface IPerpetualManagerFrontWithClaim {\n function getReward(uint256 perpetualID) external;\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\n\n function openPerpetual(\n address owner,\n uint256 amountBrought,\n uint256 amountCommitted,\n uint256 maxOracleRate,\n uint256 minNetMargin\n ) external returns (uint256 perpetualID);\n}\n" + }, + "contracts/interfaces/IPoolManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IPoolManager {\n function token() external view returns (address);\n}\n" + }, + "contracts/interfaces/ISanToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ISanToken is IERC20Upgradeable {}\n" + }, + "contracts/interfaces/IStableMasterFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IPoolManager.sol\";\nimport \"./ISanToken.sol\";\nimport \"./IPerpetualManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Struct to handle all the parameters to manage the fees\n// related to a given collateral pool (associated to the stablecoin)\nstruct MintBurnData {\n // Values of the thresholds to compute the minting fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeMint;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeMint;\n // Values of the thresholds to compute the burning fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeBurn;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeBurn;\n // Max proportion of collateral from users that can be covered by HAs\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\n // the other changes accordingly\n uint64 targetHAHedge;\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusMint;\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusBurn;\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\n uint256 capOnStableMinted;\n}\n\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\n// including the fraction of interests they receive or the fees to be distributed to\n// them\nstruct SLPData {\n // Last timestamp at which the `sanRate` has been updated for SLPs\n uint256 lastBlockUpdated;\n // Fees accumulated from previous blocks and to be distributed to SLPs\n uint256 lockedInterests;\n // Max interests used to update the `sanRate` in a single block\n // Should be in collateral token base\n uint256 maxInterestsDistributed;\n // Amount of fees left aside for SLPs and that will be distributed\n // when the protocol is collateralized back again\n uint256 feesAside;\n // Part of the fees normally going to SLPs that is left aside\n // before the protocol is collateralized back again (depends on collateral ratio)\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippageFee;\n // Portion of the fees from users minting and burning\n // that goes to SLPs (the rest goes to surplus)\n uint64 feesForSLPs;\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippage;\n // Portion of the interests from lending\n // that goes to SLPs (the rest goes to surplus)\n uint64 interestsForSLPs;\n}\n\n/// @title IStableMasterFront\n/// @author Angle Core Team\n/// @dev Front interface, meaning only user-facing functions\ninterface IStableMasterFront {\n function collateralMap(IPoolManager poolManager)\n external\n view\n returns (\n IERC20 token,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n address oracle,\n uint256 stocksUsers,\n uint256 sanRate,\n uint256 collatBase,\n SLPData memory slpData,\n MintBurnData memory feeData\n );\n\n function updateStocksUsers(uint256 amount, address poolManager) external;\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256 minStableAmount\n ) external;\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256 minCollatAmount\n ) external;\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external;\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external;\n\n function agToken() external returns (address);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Core Team\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\ninterface ISwapper {\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager``\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\n uint256 normalizedDebt;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionBorrowType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IVeANGLE\n/// @author Angle Core Team\n/// @notice Interface for the `VeANGLE` contract\ninterface IVeANGLE {\n // solhint-disable-next-line func-name-mixedcase\n function deposit_for(address addr, uint256 amount) external;\n}\n" + }, + "contracts/mock/MockAngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../implementations/mainnet/AngleRouterMainnet.sol\";\n\ncontract MockAngleRouterMainnet is AngleRouterMainnet {\n address public veAngle;\n\n function setAngleAndVeANGLE(address _veAngle) external {\n veAngle = _veAngle;\n }\n\n function _getVeANGLE() internal view override returns (IVeANGLE) {\n return IVeANGLE(veAngle);\n }\n\n function addStableMaster(IERC20 stablecoin, IStableMasterFront stableMaster) external {\n mapStableMasters[stablecoin] = stableMaster;\n }\n\n function addPairs(\n IERC20[] calldata stablecoins,\n IPoolManager[] calldata poolManagers,\n ILiquidityGauge[] calldata liquidityGauges,\n bool[] calldata justLiquidityGauges\n ) external {\n for (uint256 i; i < stablecoins.length; ++i) {\n IStableMasterFront stableMaster = mapStableMasters[stablecoins[i]];\n _addPair(stableMaster, poolManagers[i], liquidityGauges[i], justLiquidityGauges[i]);\n }\n }\n\n function _addPair(\n IStableMasterFront stableMaster,\n IPoolManager poolManager,\n ILiquidityGauge liquidityGauge,\n bool justLiquidityGauge\n ) internal {\n // Fetching the associated `sanToken` and `perpetualManager` from the contract\n (\n IERC20 collateral,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n ,\n ,\n ,\n ,\n ,\n\n ) = stableMaster.collateralMap(poolManager);\n // Reverting if the poolManager is not a valid `poolManager`\n if (address(collateral) == address(0)) revert InvalidParams();\n Pairs storage _pairs = mapPoolManagers[stableMaster][collateral];\n if (justLiquidityGauge) {\n // Cannot specify a liquidity gauge if the associated poolManager does not exist\n if (address(_pairs.poolManager) == address(0)) revert ZeroAddress();\n ILiquidityGauge gauge = _pairs.gauge;\n if (address(gauge) != address(0)) {\n _changeAllowance(IERC20(address(sanToken)), address(gauge), 0);\n }\n } else {\n // Checking if the pair has not already been initialized: if yes we need to make the function revert\n // otherwise we could end up with still approved `PoolManager` and `PerpetualManager` contracts\n if (address(_pairs.poolManager) != address(0)) revert InvalidParams();\n _pairs.poolManager = poolManager;\n _pairs.perpetualManager = IPerpetualManagerFrontWithClaim(address(perpetualManager));\n _pairs.sanToken = sanToken;\n _changeAllowance(collateral, address(stableMaster), type(uint256).max);\n _changeAllowance(collateral, address(perpetualManager), type(uint256).max);\n }\n _pairs.gauge = liquidityGauge;\n if (address(liquidityGauge) != address(0)) {\n if (address(sanToken) != liquidityGauge.staking_token()) revert InvalidParams();\n _changeAllowance(IERC20(address(sanToken)), address(liquidityGauge), type(uint256).max);\n }\n }\n}\n\ncontract MockAngleRouterMainnet2 is AngleRouterMainnet {\n function getVeANGLE() external view returns (IVeANGLE) {\n return _getVeANGLE();\n }\n}\n" + }, + "contracts/mock/MockRouterSidechain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/external/IWETH9.sol\";\n\nimport \"../BaseRouter.sol\";\n\n/// @title MockRouterSidechain\n/// @author Angle Core Team\n/// @notice Mock contract but built for tests as if to be deployed on Ethereum\ncontract MockRouterSidechain is BaseRouter {\n IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function _wrapNative() internal pure override returns (uint256) {\n return 0;\n }\n\n function _unwrapNative(uint256, address) internal pure override returns (uint256 amount) {\n return 0;\n }\n\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return WETH;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/base/AngleRouterBaseV3_0_Implementation.json b/deployments/base/AngleRouterBaseV3_0_Implementation.json new file mode 100644 index 0000000..d82a111 --- /dev/null +++ b/deployments/base/AngleRouterBaseV3_0_Implementation.json @@ -0,0 +1,618 @@ +{ + "address": "0xBC71f517AF43B296663Ae03228F25D7CBFCDdeDb", + "abi": [ + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReturnMessage", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferredDeposit", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "spenders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "changeAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit4626Referral", + "outputs": [ + { + "internalType": "uint256", + "name": "sharesOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_uniswapRouter", + "type": "address" + }, + { + "internalType": "address", + "name": "_oneInch", + "type": "address" + } + ], + "name": "initializeRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vaultManager", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitVaultManagerType[]", + "name": "paramsPermitVaultManager", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixerVaultManagerPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "oneInch", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "_core", + "type": "address" + } + ], + "name": "setCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "internalType": "uint8", + "name": "who", + "type": "uint8" + } + ], + "name": "setRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "uniswapV3Router", + "outputs": [ + { + "internalType": "contract IUniswapV3Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x11730a17139e1fdf5278ba71a6266daaf41c0448e5c5ade164a550d87a9722cd", + "receipt": { + "to": null, + "from": "0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185", + "contractAddress": "0xBC71f517AF43B296663Ae03228F25D7CBFCDdeDb", + "transactionIndex": 29, + "gasUsed": "3564218", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000", + "blockHash": "0x9b01649e7234010f697e41bb9099c5845e70461b4fed297117aa99c34a9714fd", + "transactionHash": "0x11730a17139e1fdf5278ba71a6266daaf41c0448e5c5ade164a550d87a9722cd", + "logs": [ + { + "transactionIndex": 29, + "blockNumber": 14398669, + "transactionHash": "0x11730a17139e1fdf5278ba71a6266daaf41c0448e5c5ade164a550d87a9722cd", + "address": "0xBC71f517AF43B296663Ae03228F25D7CBFCDdeDb", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 150, + "blockHash": "0x9b01649e7234010f697e41bb9099c5845e70461b4fed297117aa99c34a9714fd" + } + ], + "blockNumber": 14398669, + "cumulativeGasUsed": "10555696", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0d1b1c94fd2e1964436c8b9a0e25c545", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReturnMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApprovedOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferredDeposit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"spenders\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"changeAllowance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minSharesOut\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"deposit4626Referral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sharesOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_uniswapRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oneInch\",\"type\":\"address\"}],\"name\":\"initializeRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"vaultManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitVaultManagerType[]\",\"name\":\"paramsPermitVaultManager\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixerVaultManagerPermit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oneInch\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"setCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"who\",\"type\":\"uint8\"}],\"name\":\"setRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV3Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Router\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"params\":{\"amounts\":\"Amounts to allow\",\"spenders\":\"Addresses to allow transfer\",\"tokens\":\"Addresses of the tokens to allow\"}},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens\",\"params\":{\"actions\":\"List of actions to be performed by the router (in order of execution)\",\"data\":\"Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored\",\"paramsPermit\":\"Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\"}},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option\",\"params\":{\"paramsPermitVaultManager\":\"Parameters to sign permit to give allowance to the router for a `VaultManager` contract\"}}},\"title\":\"AngleRouterBase\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"notice\":\"Changes allowances for different tokens\"},\"core()\":{\"notice\":\"Core address handling access control\"},\"deposit4626Referral(address,address,uint256,address,uint256,address)\":{\"notice\":\"Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract\"},\"initializeRouter(address,address,address)\":{\"notice\":\"Deploys the router contract on a chain\"},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Allows composable calls to different functions within the protocol\"},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions\"},\"oneInch()\":{\"notice\":\"Address of 1Inch router used for swaps\"},\"setCore(address)\":{\"notice\":\"Sets a new `core` contract\"},\"setRouter(address,uint8)\":{\"notice\":\"Sets a new router variable\"},\"uniswapV3Router()\":{\"notice\":\"Address of the router used for swaps\"}},\"notice\":\"Router contract built specifially for Angle use cases on Base\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/implementations/base/AngleRouterBase.sol\":\"AngleRouterBase\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x9750c6fec736eb3320e85924f36a3060fa4a4ab1758d06d9585e175d164eefdb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\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 IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\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 require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\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 */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\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. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"contracts/BaseRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport \\\"./interfaces/external/uniswap/IUniswapRouter.sol\\\";\\nimport \\\"./interfaces/external/IWETH9.sol\\\";\\nimport \\\"./interfaces/ICoreBorrow.sol\\\";\\nimport \\\"./interfaces/IDepositWithReferral.sol\\\";\\nimport \\\"./interfaces/ILiquidityGauge.sol\\\";\\nimport \\\"./interfaces/ISwapper.sol\\\";\\nimport \\\"./interfaces/IVaultManager.sol\\\";\\n\\n// ============================== STRUCTS AND ENUM =============================\\n\\n/// @notice Action types\\nenum ActionType {\\n transfer,\\n wrapNative,\\n unwrapNative,\\n sweep,\\n sweepNative,\\n // Deprecated\\n uniswapV3,\\n oneInch,\\n claimRewards,\\n // Deprecated\\n gaugeDeposit,\\n borrower,\\n swapper,\\n mint4626,\\n deposit4626,\\n redeem4626,\\n withdraw4626,\\n // Deprecated\\n prepareRedeemSavingsRate,\\n // Deprecated\\n claimRedeemSavingsRate,\\n // Deprecated\\n swapIn,\\n // Deprecated\\n swapOut,\\n claimWeeklyInterest,\\n // Deprecated\\n withdraw,\\n // Deprecated\\n mint,\\n // Deprecated\\n deposit,\\n // Deprecated\\n openPerpetual,\\n // Deprecated\\n addToPerpetual,\\n veANGLEDeposit,\\n // Deprecated\\n claimRewardsWithPerps,\\n deposit4626Referral\\n}\\n\\n/// @notice Data needed to get permits\\nstruct PermitType {\\n address token;\\n address owner;\\n uint256 value;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @notice Data to grant permit to the router for a vault\\nstruct PermitVaultManagerType {\\n address vaultManager;\\n address owner;\\n bool approved;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @title BaseRouter\\n/// @author Angle Core Team\\n/// @notice Base contract that Angle router contracts on different chains should override\\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\\n using SafeERC20 for IERC20;\\n\\n // ================================= REFERENCES ================================\\n\\n /// @notice Core address handling access control\\n ICoreBorrow public core;\\n /// @notice Address of the router used for swaps\\n IUniswapV3Router public uniswapV3Router;\\n /// @notice Address of 1Inch router used for swaps\\n address public oneInch;\\n\\n uint256[47] private __gap;\\n\\n // ============================== EVENTS / ERRORS ==============================\\n\\n error IncompatibleLengths();\\n error InvalidReturnMessage();\\n error NotApprovedOrOwner();\\n error NotGovernor();\\n error NotGovernorOrGuardian();\\n error TooSmallAmountOut();\\n error TransferFailed();\\n error ZeroAddress();\\n\\n event ReferredDeposit(\\n address caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares,\\n address indexed savings,\\n address indexed referrer\\n );\\n\\n /// @notice Deploys the router contract on a chain\\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\\n if (_core == address(0)) revert ZeroAddress();\\n core = ICoreBorrow(_core);\\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\\n oneInch = _oneInch;\\n }\\n\\n constructor() initializer {}\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @notice Allows composable calls to different functions within the protocol\\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\\n /// @param actions List of actions to be performed by the router (in order of execution)\\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\\n /// for a given action are stored\\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\\n /// do not perform a sweep action on these tokens\\n function mixer(\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) public payable virtual {\\n // If all tokens have already been approved, there's no need for this step\\n uint256 permitsLength = paramsPermit.length;\\n for (uint256 i; i < permitsLength; ++i) {\\n IERC20Permit(paramsPermit[i].token).permit(\\n paramsPermit[i].owner,\\n address(this),\\n paramsPermit[i].value,\\n paramsPermit[i].deadline,\\n paramsPermit[i].v,\\n paramsPermit[i].r,\\n paramsPermit[i].s\\n );\\n }\\n // Performing actions one after the others\\n uint256 actionsLength = actions.length;\\n for (uint256 i; i < actionsLength; ++i) {\\n if (actions[i] == ActionType.transfer) {\\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\\n } else if (actions[i] == ActionType.wrapNative) {\\n _wrapNative();\\n } else if (actions[i] == ActionType.unwrapNative) {\\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\\n _unwrapNative(minAmountOut, to);\\n } else if (actions[i] == ActionType.sweep) {\\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\\n _sweep(tokenOut, minAmountOut, to);\\n } else if (actions[i] == ActionType.sweepNative) {\\n uint256 routerBalance = address(this).balance;\\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\\n } else if (actions[i] == ActionType.oneInch) {\\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\\n data[i],\\n (address, uint256, bytes)\\n );\\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\\n } else if (actions[i] == ActionType.claimRewards) {\\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\\n _claimRewards(user, claimLiquidityGauges);\\n } else if (actions[i] == ActionType.borrower) {\\n (\\n address collateral,\\n address vaultManager,\\n address to,\\n address who,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n bytes memory repayData\\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\\n } else if (actions[i] == ActionType.swapper) {\\n (\\n ISwapper swapperContract,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory payload\\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\\n } else if (actions[i] == ActionType.mint4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _mint4626(savingsRate, shares, to, maxAmountIn);\\n } else if (actions[i] == ActionType.deposit4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626(savingsRate, amount, to, minSharesOut);\\n } else if (actions[i] == ActionType.deposit4626Referral) {\\n (\\n IERC20 token,\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\\n } else if (actions[i] == ActionType.redeem4626) {\\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _redeem4626(savingsRate, shares, to, minAmountOut);\\n } else if (actions[i] == ActionType.withdraw4626) {\\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\\n } else {\\n _chainSpecificAction(actions[i], data[i]);\\n }\\n }\\n }\\n\\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\\n /// addresses depositing from a certain referring address into an ERC4626 contract\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut) {\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n _changeAllowance(IERC20(token), savings, type(uint256).max);\\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\\n }\\n\\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\\n /// actions and then revoking this approval after these actions\\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\\n /// to revoke approvals\\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\\n /// is just an option\\n function mixerVaultManagerPermit(\\n PermitVaultManagerType[] memory paramsPermitVaultManager,\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) external payable virtual {\\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n true,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n } else break;\\n }\\n mixer(paramsPermit, actions, data);\\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\\n // too deep\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (!paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n false,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n }\\n }\\n }\\n\\n receive() external payable {}\\n\\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\\n\\n /// @notice Wraps the native token of a chain to its wrapped version\\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\\n /// @dev The amount to wrap is to be specified in the `msg.value`\\n function _wrapNative() internal virtual returns (uint256) {\\n _getNativeWrapper().deposit{ value: msg.value }();\\n return msg.value;\\n }\\n\\n /// @notice Unwraps the wrapped version of a token to the native chain token\\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\\n amount = _getNativeWrapper().balanceOf(address(this));\\n _slippageCheck(amount, minAmountOut);\\n if (amount != 0) {\\n _getNativeWrapper().withdraw(amount);\\n _safeTransferNative(to, amount);\\n }\\n return amount;\\n }\\n\\n /// @notice Internal version of the `claimRewards` function\\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\\n uint256 gaugesLength = liquidityGauges.length;\\n for (uint256 i; i < gaugesLength; ++i) {\\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\\n }\\n }\\n\\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\\n /// @param vaultManager Address of the vault to perform actions on\\n /// @param actionsBorrow Actions type to perform on the vaultManager\\n /// @param dataBorrow Data needed for each actions\\n /// @param to Address to send the funds to\\n /// @param who Swapper address to handle repayments\\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\\n function _angleBorrower(\\n address vaultManager,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address to,\\n address who,\\n bytes memory repayData\\n ) internal virtual returns (PaymentData memory paymentData) {\\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\\n }\\n\\n /// @notice Sweeps tokens from the router contract\\n /// @param tokenOut Token to sweep\\n /// @param minAmountOut Minimum amount of tokens to recover\\n /// @param to Address to which tokens should be sent\\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\\n _slippageCheck(balanceToken, minAmountOut);\\n if (balanceToken != 0) {\\n IERC20(tokenOut).safeTransfer(to, balanceToken);\\n }\\n }\\n\\n /// @notice Uses an external swapper\\n /// @param swapper Contracts implementing the logic of the swap\\n /// @param inToken Token used to do the swap\\n /// @param outToken Token wanted\\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\\n /// @param inTokenObtained Amount of `inToken` used for the swap\\n /// @param data Additional info for the specific swapper\\n function _swapper(\\n ISwapper swapper,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) internal {\\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\\n }\\n\\n /// @notice Swaps an inToken to another token via 1Inch Router\\n /// @param payload Bytes needed for 1Inch router to process the swap\\n /// @dev The `payload` given is expected to be obtained from 1Inch API\\n function _swapOn1Inch(\\n IERC20 inToken,\\n uint256 minAmountOut,\\n bytes memory payload\\n ) internal returns (uint256 amountOut) {\\n // Approve transfer to the `oneInch` address\\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\\n address oneInchRouter = oneInch;\\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\\n //solhint-disable-next-line\\n (bool success, bytes memory result) = oneInchRouter.call(payload);\\n if (!success) _revertBytes(result);\\n\\n amountOut = abi.decode(result, (uint256));\\n _slippageCheck(amountOut, minAmountOut);\\n }\\n\\n /// @notice Mints `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to mint shares from\\n /// @param shares Amount of shares to mint from the contract\\n /// @param to Address to which shares should be sent\\n /// @param maxAmountIn Max amount of assets used to mint\\n /// @return amountIn Amount of assets used to mint by `to`\\n function _mint4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 maxAmountIn\\n ) internal returns (uint256 amountIn) {\\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\\n }\\n\\n /// @notice Deposits `amount` to an ERC4626 contract\\n /// @param savingsRate The ERC4626 to deposit assets to\\n /// @param amount Amount of assets to deposit\\n /// @param to Address to which shares should be sent\\n /// @param minSharesOut Minimum amount of shares that `to` should received\\n /// @return sharesOut Amount of shares received by `to`\\n function _deposit4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\\n }\\n\\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\\n function _deposit4626Referral(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) internal returns (uint256 sharesOut) {\\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\\n }\\n\\n /// @notice Withdraws `amount` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to withdraw assets from\\n /// @param amount Amount of assets to withdraw\\n /// @param to Destination of assets\\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\\n /// @return sharesOut Amount of shares burnt\\n function _withdraw4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 maxSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\\n }\\n\\n /// @notice Redeems `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to redeem shares from\\n /// @param shares Amount of shares to redeem\\n /// @param to Destination of assets\\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\\n /// @return amountOut Amount of assets received by `to`\\n function _redeem4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 minAmountOut\\n ) internal returns (uint256 amountOut) {\\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\\n }\\n\\n /// @notice Allows to perform some specific actions for a chain\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\\n\\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\\n\\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\\n\\n // ============================ GOVERNANCE FUNCTION ============================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Sets a new `core` contract\\n function setCore(ICoreBorrow _core) external {\\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\\n core = ICoreBorrow(_core);\\n }\\n\\n /// @notice Changes allowances for different tokens\\n /// @param tokens Addresses of the tokens to allow\\n /// @param spenders Addresses to allow transfer\\n /// @param amounts Amounts to allow\\n function changeAllowance(\\n IERC20[] calldata tokens,\\n address[] calldata spenders,\\n uint256[] calldata amounts\\n ) external onlyGovernorOrGuardian {\\n uint256 tokensLength = tokens.length;\\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\\n for (uint256 i; i < tokensLength; ++i) {\\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\\n }\\n }\\n\\n /// @notice Sets a new router variable\\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\\n if (router == address(0)) revert ZeroAddress();\\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\\n else oneInch = router;\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Changes allowance of this contract for a given token\\n /// @param token Address of the token to change allowance\\n /// @param spender Address to change the allowance of\\n /// @param amount Amount allowed\\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\\n } else if (currentAllowance > amount) {\\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\\n }\\n }\\n\\n /// @notice Transfer amount of the native token to the `to` address\\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\\n function _safeTransferNative(address to, uint256 amount) internal {\\n bool success;\\n //solhint-disable-next-line\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n if (!success) revert TransferFailed();\\n }\\n\\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\\n /// the calling address is well approved for all the vaults with which it is interacting\\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\\n /// with a vault are approved for this vault\\n function _parseVaultIDs(\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address vaultManager,\\n address collateral\\n ) internal view returns (bytes[] memory) {\\n uint256 actionsBorrowLength = actionsBorrow.length;\\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\\n bool createVaultAction;\\n uint256 lastVaultID;\\n uint256 vaultIDLength;\\n for (uint256 i; i < actionsBorrowLength; ++i) {\\n uint256 vaultID;\\n // If there is a `createVault` action, the router should not worry about looking at\\n // next vaultIDs given equal to 0\\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\\n createVaultAction = true;\\n continue;\\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\\n // as collateral the full contract balance\\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\\n uint256 amount;\\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\\n if (amount == type(uint256).max)\\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\\n continue;\\n // There are different ways depending on the action to find the `vaultID` to parse\\n } else if (\\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\\n ) {\\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\\n vaultID = abi.decode(dataBorrow[i], (uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\\n } else continue;\\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\\n // if there has not been any specific action\\n if (vaultID == 0) {\\n if (createVaultAction) {\\n continue;\\n } else {\\n // If we haven't stored the last `vaultID`, we need to fetch it\\n if (lastVaultID == 0) {\\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\\n }\\n vaultID = lastVaultID;\\n }\\n }\\n\\n // Check if this `vaultID` has already been verified\\n for (uint256 j; j < vaultIDLength; ++j) {\\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\\n // If yes, we continue to the next iteration\\n continue;\\n }\\n }\\n // Verify this new `vaultID` and add it to the list\\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\\n revert NotApprovedOrOwner();\\n }\\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\\n vaultIDLength += 1;\\n }\\n return dataBorrow;\\n }\\n\\n /// @notice Checks whether the amount obtained during a swap is not too small\\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\\n if (amount < thresholdAmount) revert TooSmallAmountOut();\\n }\\n\\n /// @notice Internal function used for error handling\\n function _revertBytes(bytes memory errMsg) internal pure {\\n if (errMsg.length != 0) {\\n //solhint-disable-next-line\\n assembly {\\n revert(add(32, errMsg), mload(errMsg))\\n }\\n }\\n revert InvalidReturnMessage();\\n }\\n}\\n\",\"keccak256\":\"0x5b45e51240ed42ae858c34a0e7e15003885bd998d3a47da7a4fa5604b69f5c2f\",\"license\":\"GPL-3.0\"},\"contracts/implementations/base/AngleRouterBase.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"../../BaseRouter.sol\\\";\\n\\n/// @title AngleRouterBase\\n/// @author Angle Core Team\\n/// @notice Router contract built specifially for Angle use cases on Base\\ncontract AngleRouterBase is BaseRouter {\\n /// @inheritdoc BaseRouter\\n /// @dev There is no wCELO contract on CELO\\n function _getNativeWrapper() internal pure override returns (IWETH9) {\\n return IWETH9(0x4200000000000000000000000000000000000006);\\n }\\n}\\n\",\"keccak256\":\"0x0923f42320f9baa6967ade82a27d88db2d83afb36be4f49458fdd7916d839e0b\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ICoreBorrow.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICoreBorrow\\n/// @author Angle Core Team\\n/// @notice Interface for the `CoreBorrow` contract\\n\\ninterface ICoreBorrow {\\n /// @notice Checks whether an address is governor of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2414539c445977b04bc7e9adac2e5147364994dd74e5d7118b44824956de602c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDepositWithReferral.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IDepositWithReferral\\n/// @author Angle Core Team\\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\\ninterface IDepositWithReferral {\\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\\n /// obtained, the function reverts\\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\\n /// when a deposit takes place\\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut);\\n}\\n\",\"keccak256\":\"0x69b88fa9ec5111394843f54f312c3b8c1b47490c76109a97ba90e4ac5697e960\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ILiquidityGauge.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface ILiquidityGauge {\\n // solhint-disable-next-line\\n function staking_token() external returns (address stakingToken);\\n\\n // solhint-disable-next-line\\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\\n\\n function deposit(\\n uint256 _value,\\n address _addr,\\n // solhint-disable-next-line\\n bool _claim_rewards\\n ) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr, address _receiver) external;\\n}\\n\",\"keccak256\":\"0x27144c21760603a4e441bb5eecf975ad7f71331ac0ba0a83352b280ccf734756\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\n/// @title ISwapper\\n/// @author Angle Core Team\\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\\ninterface ISwapper {\\n function swap(\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0x506f50d8447c2dc662bd844779cc66a407af07a91210612b956ef47abcc15776\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITreasury.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ITreasury\\n/// @author Angle Core Team\\n/// @notice Interface for the `Treasury` contract\\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\\n/// of this module\\ninterface ITreasury {\\n /// @notice Checks whether a given address has well been initialized in this contract\\n /// as a `VaultManager``\\n /// @param _vaultManager Address to check\\n /// @return Whether the address has been initialized or not\\n function isVaultManager(address _vaultManager) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x36bd50a0ab1c46503bb64b8d5777bf3b4fd2da0e2dcfe68c8a9702eb132eb3e2\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVaultManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./ITreasury.sol\\\";\\n\\n// ========================= Key Structs and Enums =============================\\n\\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\\n/// to the caller or associated addresses\\nstruct PaymentData {\\n // Stablecoin amount the contract should give\\n uint256 stablecoinAmountToGive;\\n // Stablecoin amount owed to the contract\\n uint256 stablecoinAmountToReceive;\\n // Collateral amount the contract should give\\n uint256 collateralAmountToGive;\\n // Collateral amount owed to the contract\\n uint256 collateralAmountToReceive;\\n}\\n\\n/// @notice Data stored to track someone's loan (or equivalently called position)\\nstruct Vault {\\n // Amount of collateral deposited in the vault\\n uint256 collateralAmount;\\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\\n uint256 normalizedDebt;\\n}\\n\\n/// @notice Actions possible when composing calls to the different entry functions proposed\\nenum ActionBorrowType {\\n createVault,\\n closeVault,\\n addCollateral,\\n removeCollateral,\\n repayDebt,\\n borrow,\\n getDebtIn,\\n permit\\n}\\n\\n// ========================= Interfaces =============================\\n\\n/// @title IVaultManagerFunctions\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface only contains functions of the contract which are called by other contracts\\n/// of this module (without getters)\\ninterface IVaultManagerFunctions {\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\\n /// @param repayData Data to pass to the repayment contract in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to,\\n address who,\\n bytes memory repayData\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Checks whether a given address is approved for a vault or owns this vault\\n /// @param spender Address for which vault ownership should be checked\\n /// @param vaultID ID of the vault to check\\n /// @return Whether the `spender` address owns or is approved for `vaultID`\\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\\n\\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\\n /// @param spender Address to give approval to\\n /// @param approved Whether to give or revoke the approval\\n /// @param deadline Deadline parameter for the signature to be valid\\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\\n function permit(\\n address owner,\\n address spender,\\n bool approved,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\\n/// @title IVaultManagerStorage\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface contains getters of the contract's public variables used by other contracts\\n/// of this module\\ninterface IVaultManagerStorage {\\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\\n function treasury() external view returns (ITreasury);\\n\\n /// @notice Reference to the collateral handled by this `VaultManager`\\n function collateral() external view returns (IERC20);\\n\\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\\n function vaultIDCount() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4cf6dc5e5b494165e4d9e524dca5c65f6307e5b005a62287c5e84f1539dc81f1\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title Interface for WETH9\\ninterface IWETH9 is IERC20 {\\n /// @notice Deposit ether to get wrapped ether\\n function deposit() external payable;\\n\\n /// @notice Withdraw wrapped ether to get ether\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0xb109c1d668416c05f61d6edea2ec7a10b2f8b386fd51a59cc12f929c73d00424\",\"license\":\"GPL-2.0-or-later\"},\"contracts/interfaces/external/uniswap/IUniswapRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nstruct ExactInputParams {\\n bytes path;\\n address recipient;\\n uint256 deadline;\\n uint256 amountIn;\\n uint256 amountOutMinimum;\\n}\\n\\n/// @title Router token swapping functionality\\n/// @notice Functions for swapping tokens via Uniswap V3\\ninterface IUniswapV3Router {\\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\\n /// @return amountOut The amount of the received token\\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\\n}\\n\\n/// @title Router for price estimation functionality\\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\\n/// @dev This interface is only used for non critical elements of the protocol\\ninterface IUniswapV2Router {\\n /// @notice Given an input asset amount, returns the maximum output amount of the\\n /// other asset (accounting for fees) given reserves.\\n /// @param path Addresses of the pools used to get prices\\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\\n\\n function swapExactTokensForTokens(\\n uint256 swapAmount,\\n uint256 minExpected,\\n address[] calldata path,\\n address receiver,\\n uint256 swapDeadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x1908fcdc6ff78ad2250f6ccacc7129df464a648cb2a5f376bedbe506d058bb73\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620018d51760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b613f52806200015c6000396000f3fe6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073420000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b60007342000000000000000000000000000000000000066040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273420000000000000000000000000000000000000690632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220e5d9d1663dbbc4f159fda75b3a00c37800f1fb3a989e656544b9bd3b0b09ab7264736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073420000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b60007342000000000000000000000000000000000000066040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273420000000000000000000000000000000000000690632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220e5d9d1663dbbc4f159fda75b3a00c37800f1fb3a989e656544b9bd3b0b09ab7264736f6c63430008110033", + "devdoc": { + "author": "Angle Core Team", + "kind": "dev", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "params": { + "amounts": "Amounts to allow", + "spenders": "Addresses to allow transfer", + "tokens": "Addresses of the tokens to allow" + } + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens", + "params": { + "actions": "List of actions to be performed by the router (in order of execution)", + "data": "Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored", + "paramsPermit": "Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it" + } + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option", + "params": { + "paramsPermitVaultManager": "Parameters to sign permit to give allowance to the router for a `VaultManager` contract" + } + } + }, + "title": "AngleRouterBase", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "notice": "Changes allowances for different tokens" + }, + "core()": { + "notice": "Core address handling access control" + }, + "deposit4626Referral(address,address,uint256,address,uint256,address)": { + "notice": "Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract" + }, + "initializeRouter(address,address,address)": { + "notice": "Deploys the router contract on a chain" + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Allows composable calls to different functions within the protocol" + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions" + }, + "oneInch()": { + "notice": "Address of 1Inch router used for swaps" + }, + "setCore(address)": { + "notice": "Sets a new `core` contract" + }, + "setRouter(address,uint8)": { + "notice": "Sets a new router variable" + }, + "uniswapV3Router()": { + "notice": "Address of the router used for swaps" + } + }, + "notice": "Router contract built specifially for Angle use cases on Base", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6, + "contract": "contracts/implementations/base/AngleRouterBase.sol:AngleRouterBase", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 9, + "contract": "contracts/implementations/base/AngleRouterBase.sol:AngleRouterBase", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 1478, + "contract": "contracts/implementations/base/AngleRouterBase.sol:AngleRouterBase", + "label": "core", + "offset": 2, + "slot": "0", + "type": "t_contract(ICoreBorrow)3793" + }, + { + "astId": 1482, + "contract": "contracts/implementations/base/AngleRouterBase.sol:AngleRouterBase", + "label": "uniswapV3Router", + "offset": 0, + "slot": "1", + "type": "t_contract(IUniswapV3Router)4262" + }, + { + "astId": 1485, + "contract": "contracts/implementations/base/AngleRouterBase.sol:AngleRouterBase", + "label": "oneInch", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 1489, + "contract": "contracts/implementations/base/AngleRouterBase.sol:AngleRouterBase", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint256)47_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ICoreBorrow)3793": { + "encoding": "inplace", + "label": "contract ICoreBorrow", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Router)4262": { + "encoding": "inplace", + "label": "contract IUniswapV3Router", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/base/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json b/deployments/base/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json new file mode 100644 index 0000000..c75418b --- /dev/null +++ b/deployments/base/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json @@ -0,0 +1,142 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\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 IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\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 require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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 */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\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. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/BaseRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport \"./interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./interfaces/external/IWETH9.sol\";\nimport \"./interfaces/ICoreBorrow.sol\";\nimport \"./interfaces/IDepositWithReferral.sol\";\nimport \"./interfaces/ILiquidityGauge.sol\";\nimport \"./interfaces/ISwapper.sol\";\nimport \"./interfaces/IVaultManager.sol\";\n\n// ============================== STRUCTS AND ENUM =============================\n\n/// @notice Action types\nenum ActionType {\n transfer,\n wrapNative,\n unwrapNative,\n sweep,\n sweepNative,\n // Deprecated\n uniswapV3,\n oneInch,\n claimRewards,\n // Deprecated\n gaugeDeposit,\n borrower,\n swapper,\n mint4626,\n deposit4626,\n redeem4626,\n withdraw4626,\n // Deprecated\n prepareRedeemSavingsRate,\n // Deprecated\n claimRedeemSavingsRate,\n // Deprecated\n swapIn,\n // Deprecated\n swapOut,\n claimWeeklyInterest,\n // Deprecated\n withdraw,\n // Deprecated\n mint,\n // Deprecated\n deposit,\n // Deprecated\n openPerpetual,\n // Deprecated\n addToPerpetual,\n veANGLEDeposit,\n // Deprecated\n claimRewardsWithPerps,\n deposit4626Referral\n}\n\n/// @notice Data needed to get permits\nstruct PermitType {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @notice Data to grant permit to the router for a vault\nstruct PermitVaultManagerType {\n address vaultManager;\n address owner;\n bool approved;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @title BaseRouter\n/// @author Angle Core Team\n/// @notice Base contract that Angle router contracts on different chains should override\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\n using SafeERC20 for IERC20;\n\n // ================================= REFERENCES ================================\n\n /// @notice Core address handling access control\n ICoreBorrow public core;\n /// @notice Address of the router used for swaps\n IUniswapV3Router public uniswapV3Router;\n /// @notice Address of 1Inch router used for swaps\n address public oneInch;\n\n uint256[47] private __gap;\n\n // ============================== EVENTS / ERRORS ==============================\n\n error IncompatibleLengths();\n error InvalidReturnMessage();\n error NotApprovedOrOwner();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error TooSmallAmountOut();\n error TransferFailed();\n error ZeroAddress();\n\n event ReferredDeposit(\n address caller,\n address indexed owner,\n uint256 assets,\n uint256 shares,\n address indexed savings,\n address indexed referrer\n );\n\n /// @notice Deploys the router contract on a chain\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\n if (_core == address(0)) revert ZeroAddress();\n core = ICoreBorrow(_core);\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\n oneInch = _oneInch;\n }\n\n constructor() initializer {}\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @notice Allows composable calls to different functions within the protocol\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\n /// @param actions List of actions to be performed by the router (in order of execution)\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\n /// for a given action are stored\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\n /// do not perform a sweep action on these tokens\n function mixer(\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) public payable virtual {\n // If all tokens have already been approved, there's no need for this step\n uint256 permitsLength = paramsPermit.length;\n for (uint256 i; i < permitsLength; ++i) {\n IERC20Permit(paramsPermit[i].token).permit(\n paramsPermit[i].owner,\n address(this),\n paramsPermit[i].value,\n paramsPermit[i].deadline,\n paramsPermit[i].v,\n paramsPermit[i].r,\n paramsPermit[i].s\n );\n }\n // Performing actions one after the others\n uint256 actionsLength = actions.length;\n for (uint256 i; i < actionsLength; ++i) {\n if (actions[i] == ActionType.transfer) {\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\n } else if (actions[i] == ActionType.wrapNative) {\n _wrapNative();\n } else if (actions[i] == ActionType.unwrapNative) {\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\n _unwrapNative(minAmountOut, to);\n } else if (actions[i] == ActionType.sweep) {\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\n _sweep(tokenOut, minAmountOut, to);\n } else if (actions[i] == ActionType.sweepNative) {\n uint256 routerBalance = address(this).balance;\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\n } else if (actions[i] == ActionType.oneInch) {\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\n data[i],\n (address, uint256, bytes)\n );\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\n } else if (actions[i] == ActionType.claimRewards) {\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\n _claimRewards(user, claimLiquidityGauges);\n } else if (actions[i] == ActionType.borrower) {\n (\n address collateral,\n address vaultManager,\n address to,\n address who,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n bytes memory repayData\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\n } else if (actions[i] == ActionType.swapper) {\n (\n ISwapper swapperContract,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory payload\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\n } else if (actions[i] == ActionType.mint4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _mint4626(savingsRate, shares, to, maxAmountIn);\n } else if (actions[i] == ActionType.deposit4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626(savingsRate, amount, to, minSharesOut);\n } else if (actions[i] == ActionType.deposit4626Referral) {\n (\n IERC20 token,\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\n } else if (actions[i] == ActionType.redeem4626) {\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _redeem4626(savingsRate, shares, to, minAmountOut);\n } else if (actions[i] == ActionType.withdraw4626) {\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\n } else {\n _chainSpecificAction(actions[i], data[i]);\n }\n }\n }\n\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\n /// addresses depositing from a certain referring address into an ERC4626 contract\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n _changeAllowance(IERC20(token), savings, type(uint256).max);\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\n }\n\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\n /// actions and then revoking this approval after these actions\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\n /// to revoke approvals\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\n /// is just an option\n function mixerVaultManagerPermit(\n PermitVaultManagerType[] memory paramsPermitVaultManager,\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) external payable virtual {\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n true,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n } else break;\n }\n mixer(paramsPermit, actions, data);\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\n // too deep\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (!paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n false,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n }\n }\n }\n\n receive() external payable {}\n\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\n\n /// @notice Wraps the native token of a chain to its wrapped version\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\n /// @dev The amount to wrap is to be specified in the `msg.value`\n function _wrapNative() internal virtual returns (uint256) {\n _getNativeWrapper().deposit{ value: msg.value }();\n return msg.value;\n }\n\n /// @notice Unwraps the wrapped version of a token to the native chain token\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\n amount = _getNativeWrapper().balanceOf(address(this));\n _slippageCheck(amount, minAmountOut);\n if (amount != 0) {\n _getNativeWrapper().withdraw(amount);\n _safeTransferNative(to, amount);\n }\n return amount;\n }\n\n /// @notice Internal version of the `claimRewards` function\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\n uint256 gaugesLength = liquidityGauges.length;\n for (uint256 i; i < gaugesLength; ++i) {\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\n }\n }\n\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\n /// @param vaultManager Address of the vault to perform actions on\n /// @param actionsBorrow Actions type to perform on the vaultManager\n /// @param dataBorrow Data needed for each actions\n /// @param to Address to send the funds to\n /// @param who Swapper address to handle repayments\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\n function _angleBorrower(\n address vaultManager,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address to,\n address who,\n bytes memory repayData\n ) internal virtual returns (PaymentData memory paymentData) {\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\n }\n\n /// @notice Sweeps tokens from the router contract\n /// @param tokenOut Token to sweep\n /// @param minAmountOut Minimum amount of tokens to recover\n /// @param to Address to which tokens should be sent\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\n _slippageCheck(balanceToken, minAmountOut);\n if (balanceToken != 0) {\n IERC20(tokenOut).safeTransfer(to, balanceToken);\n }\n }\n\n /// @notice Uses an external swapper\n /// @param swapper Contracts implementing the logic of the swap\n /// @param inToken Token used to do the swap\n /// @param outToken Token wanted\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\n /// @param inTokenObtained Amount of `inToken` used for the swap\n /// @param data Additional info for the specific swapper\n function _swapper(\n ISwapper swapper,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) internal {\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\n }\n\n /// @notice Swaps an inToken to another token via 1Inch Router\n /// @param payload Bytes needed for 1Inch router to process the swap\n /// @dev The `payload` given is expected to be obtained from 1Inch API\n function _swapOn1Inch(\n IERC20 inToken,\n uint256 minAmountOut,\n bytes memory payload\n ) internal returns (uint256 amountOut) {\n // Approve transfer to the `oneInch` address\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\n address oneInchRouter = oneInch;\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\n //solhint-disable-next-line\n (bool success, bytes memory result) = oneInchRouter.call(payload);\n if (!success) _revertBytes(result);\n\n amountOut = abi.decode(result, (uint256));\n _slippageCheck(amountOut, minAmountOut);\n }\n\n /// @notice Mints `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to mint shares from\n /// @param shares Amount of shares to mint from the contract\n /// @param to Address to which shares should be sent\n /// @param maxAmountIn Max amount of assets used to mint\n /// @return amountIn Amount of assets used to mint by `to`\n function _mint4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 maxAmountIn\n ) internal returns (uint256 amountIn) {\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\n }\n\n /// @notice Deposits `amount` to an ERC4626 contract\n /// @param savingsRate The ERC4626 to deposit assets to\n /// @param amount Amount of assets to deposit\n /// @param to Address to which shares should be sent\n /// @param minSharesOut Minimum amount of shares that `to` should received\n /// @return sharesOut Amount of shares received by `to`\n function _deposit4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\n }\n\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\n function _deposit4626Referral(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) internal returns (uint256 sharesOut) {\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\n }\n\n /// @notice Withdraws `amount` from an ERC4626 contract\n /// @param savingsRate ERC4626 to withdraw assets from\n /// @param amount Amount of assets to withdraw\n /// @param to Destination of assets\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\n /// @return sharesOut Amount of shares burnt\n function _withdraw4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 maxSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\n }\n\n /// @notice Redeems `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to redeem shares from\n /// @param shares Amount of shares to redeem\n /// @param to Destination of assets\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\n /// @return amountOut Amount of assets received by `to`\n function _redeem4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 minAmountOut\n ) internal returns (uint256 amountOut) {\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\n }\n\n /// @notice Allows to perform some specific actions for a chain\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\n\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\n\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\n\n // ============================ GOVERNANCE FUNCTION ============================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Sets a new `core` contract\n function setCore(ICoreBorrow _core) external {\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\n core = ICoreBorrow(_core);\n }\n\n /// @notice Changes allowances for different tokens\n /// @param tokens Addresses of the tokens to allow\n /// @param spenders Addresses to allow transfer\n /// @param amounts Amounts to allow\n function changeAllowance(\n IERC20[] calldata tokens,\n address[] calldata spenders,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\n for (uint256 i; i < tokensLength; ++i) {\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\n }\n }\n\n /// @notice Sets a new router variable\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\n if (router == address(0)) revert ZeroAddress();\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\n else oneInch = router;\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Changes allowance of this contract for a given token\n /// @param token Address of the token to change allowance\n /// @param spender Address to change the allowance of\n /// @param amount Amount allowed\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\n uint256 currentAllowance = token.allowance(address(this), spender);\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\n } else if (currentAllowance > amount) {\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\n }\n }\n\n /// @notice Transfer amount of the native token to the `to` address\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\n function _safeTransferNative(address to, uint256 amount) internal {\n bool success;\n //solhint-disable-next-line\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) revert TransferFailed();\n }\n\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\n /// the calling address is well approved for all the vaults with which it is interacting\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\n /// with a vault are approved for this vault\n function _parseVaultIDs(\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address vaultManager,\n address collateral\n ) internal view returns (bytes[] memory) {\n uint256 actionsBorrowLength = actionsBorrow.length;\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\n bool createVaultAction;\n uint256 lastVaultID;\n uint256 vaultIDLength;\n for (uint256 i; i < actionsBorrowLength; ++i) {\n uint256 vaultID;\n // If there is a `createVault` action, the router should not worry about looking at\n // next vaultIDs given equal to 0\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\n createVaultAction = true;\n continue;\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\n // as collateral the full contract balance\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\n uint256 amount;\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\n if (amount == type(uint256).max)\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\n continue;\n // There are different ways depending on the action to find the `vaultID` to parse\n } else if (\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\n ) {\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\n vaultID = abi.decode(dataBorrow[i], (uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\n } else continue;\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\n // if there has not been any specific action\n if (vaultID == 0) {\n if (createVaultAction) {\n continue;\n } else {\n // If we haven't stored the last `vaultID`, we need to fetch it\n if (lastVaultID == 0) {\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\n }\n vaultID = lastVaultID;\n }\n }\n\n // Check if this `vaultID` has already been verified\n for (uint256 j; j < vaultIDLength; ++j) {\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\n // If yes, we continue to the next iteration\n continue;\n }\n }\n // Verify this new `vaultID` and add it to the list\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\n revert NotApprovedOrOwner();\n }\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\n vaultIDLength += 1;\n }\n return dataBorrow;\n }\n\n /// @notice Checks whether the amount obtained during a swap is not too small\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\n if (amount < thresholdAmount) revert TooSmallAmountOut();\n }\n\n /// @notice Internal function used for error handling\n function _revertBytes(bytes memory errMsg) internal pure {\n if (errMsg.length != 0) {\n //solhint-disable-next-line\n assembly {\n revert(add(32, errMsg), mload(errMsg))\n }\n }\n revert InvalidReturnMessage();\n }\n}\n" + }, + "contracts/implementations/arbitrum/AngleRouterArbitrum.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterArbitrum\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\ncontract AngleRouterArbitrum is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n }\n}\n" + }, + "contracts/implementations/avalanche/AngleRouterAvalanche.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterAvalanche\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Avalanche\ncontract AngleRouterAvalanche is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n }\n}\n" + }, + "contracts/implementations/base/AngleRouterBase.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterBase\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Base\ncontract AngleRouterBase is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/celo/AngleRouterCelo.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterCelo\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Celo\ncontract AngleRouterCelo is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0000000000000000000000000000000000000000);\n }\n}\n" + }, + "contracts/implementations/gnosis/AngleRouterGnosis.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterGnosis\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Gnosis\ncontract AngleRouterGnosis is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n }\n}\n" + }, + "contracts/implementations/mainnet/AngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../interfaces/IFeeDistributorFront.sol\";\nimport \"../../interfaces/ISanToken.sol\";\nimport \"../../interfaces/IStableMasterFront.sol\";\nimport \"../../interfaces/IVeANGLE.sol\";\n\nimport \"../../BaseRouter.sol\";\n\n// ============================= STRUCTS AND ENUMS =============================\n\n/// @notice References to the contracts associated to a collateral for a stablecoin\nstruct Pairs {\n IPoolManager poolManager;\n IPerpetualManagerFrontWithClaim perpetualManager;\n ISanToken sanToken;\n ILiquidityGauge gauge;\n}\n\n/// @title AngleRouterMainnet\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Ethereum\n/// @dev Previous implementation with an initialization function can be found here:\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\ncontract AngleRouterMainnet is BaseRouter {\n using SafeERC20 for IERC20;\n\n // =================================== ERRORS ==================================\n\n error InvalidParams();\n\n // ================================== MAPPINGS =================================\n\n /// @notice Maps an agToken to its counterpart `StableMaster`\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\n\n uint256[48] private __gapMainnet;\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @inheritdoc BaseRouter\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\n if (action == ActionType.claimWeeklyInterest) {\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\n } else if (action == ActionType.veANGLEDeposit) {\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\n _depositOnLocker(user, amount);\n }\n }\n\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n }\n\n /// @notice Deposits ANGLE on an existing locker\n /// @param user Address to deposit for\n /// @param amount Amount to deposit\n function _depositOnLocker(address user, uint256 amount) internal {\n _getVeANGLE().deposit_for(user, amount);\n }\n\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\n /// @param user Address to claim for\n /// @param _feeDistributor Address of the fee distributor to claim to\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\n /// transfer the token claimed from the `feeDistributor`\n function _claimWeeklyInterest(\n address user,\n IFeeDistributorFront _feeDistributor,\n bool letInContract\n ) internal {\n uint256 amount = _feeDistributor.claim(user);\n if (letInContract) {\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\n IERC20 token = IERC20(_feeDistributor.token());\n token.safeTransferFrom(msg.sender, address(this), amount);\n }\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Returns the veANGLE address\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\n }\n}\n" + }, + "contracts/implementations/optimism/AngleRouterOptimism.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterOptimism\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Optimism\ncontract AngleRouterOptimism is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/polygon/AngleRouterPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterPolygon\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Polygon\ncontract AngleRouterPolygon is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n }\n}\n" + }, + "contracts/interfaces/external/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nstruct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n}\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IUniswapV3Router {\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n\n/// @title Router for price estimation functionality\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\n/// @dev This interface is only used for non critical elements of the protocol\ninterface IUniswapV2Router {\n /// @notice Given an input asset amount, returns the maximum output amount of the\n /// other asset (accounting for fees) given reserves.\n /// @param path Addresses of the pools used to get prices\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokens(\n uint256 swapAmount,\n uint256 minExpected,\n address[] calldata path,\n address receiver,\n uint256 swapDeadline\n ) external;\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICoreBorrow\n/// @author Angle Core Team\n/// @notice Interface for the `CoreBorrow` contract\n\ninterface ICoreBorrow {\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IDepositWithReferral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title IDepositWithReferral\n/// @author Angle Core Team\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\ninterface IDepositWithReferral {\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\n /// obtained, the function reverts\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\n /// when a deposit takes place\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut);\n}\n" + }, + "contracts/interfaces/IFeeDistributorFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IFeeDistributorFront\n/// @author Interface for public use of the `FeeDistributor` contract\n/// @dev This interface is used for user related function\ninterface IFeeDistributorFront {\n function token() external returns (address);\n\n function claim(address _addr) external returns (uint256);\n\n function claim(address[20] memory _addr) external returns (bool);\n}\n" + }, + "contracts/interfaces/ILiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function staking_token() external returns (address stakingToken);\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external;\n}\n" + }, + "contracts/interfaces/IPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title Interface of the contract managing perpetuals with claim function\n/// @author Angle Core Team\n/// @dev Front interface with rewards function, meaning only user-facing functions\ninterface IPerpetualManagerFrontWithClaim {\n function getReward(uint256 perpetualID) external;\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\n\n function openPerpetual(\n address owner,\n uint256 amountBrought,\n uint256 amountCommitted,\n uint256 maxOracleRate,\n uint256 minNetMargin\n ) external returns (uint256 perpetualID);\n}\n" + }, + "contracts/interfaces/IPoolManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IPoolManager {\n function token() external view returns (address);\n}\n" + }, + "contracts/interfaces/ISanToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ISanToken is IERC20Upgradeable {}\n" + }, + "contracts/interfaces/IStableMasterFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IPoolManager.sol\";\nimport \"./ISanToken.sol\";\nimport \"./IPerpetualManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Struct to handle all the parameters to manage the fees\n// related to a given collateral pool (associated to the stablecoin)\nstruct MintBurnData {\n // Values of the thresholds to compute the minting fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeMint;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeMint;\n // Values of the thresholds to compute the burning fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeBurn;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeBurn;\n // Max proportion of collateral from users that can be covered by HAs\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\n // the other changes accordingly\n uint64 targetHAHedge;\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusMint;\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusBurn;\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\n uint256 capOnStableMinted;\n}\n\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\n// including the fraction of interests they receive or the fees to be distributed to\n// them\nstruct SLPData {\n // Last timestamp at which the `sanRate` has been updated for SLPs\n uint256 lastBlockUpdated;\n // Fees accumulated from previous blocks and to be distributed to SLPs\n uint256 lockedInterests;\n // Max interests used to update the `sanRate` in a single block\n // Should be in collateral token base\n uint256 maxInterestsDistributed;\n // Amount of fees left aside for SLPs and that will be distributed\n // when the protocol is collateralized back again\n uint256 feesAside;\n // Part of the fees normally going to SLPs that is left aside\n // before the protocol is collateralized back again (depends on collateral ratio)\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippageFee;\n // Portion of the fees from users minting and burning\n // that goes to SLPs (the rest goes to surplus)\n uint64 feesForSLPs;\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippage;\n // Portion of the interests from lending\n // that goes to SLPs (the rest goes to surplus)\n uint64 interestsForSLPs;\n}\n\n/// @title IStableMasterFront\n/// @author Angle Core Team\n/// @dev Front interface, meaning only user-facing functions\ninterface IStableMasterFront {\n function collateralMap(IPoolManager poolManager)\n external\n view\n returns (\n IERC20 token,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n address oracle,\n uint256 stocksUsers,\n uint256 sanRate,\n uint256 collatBase,\n SLPData memory slpData,\n MintBurnData memory feeData\n );\n\n function updateStocksUsers(uint256 amount, address poolManager) external;\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256 minStableAmount\n ) external;\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256 minCollatAmount\n ) external;\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external;\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external;\n\n function agToken() external returns (address);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Core Team\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\ninterface ISwapper {\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager``\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\n uint256 normalizedDebt;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionBorrowType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IVeANGLE\n/// @author Angle Core Team\n/// @notice Interface for the `VeANGLE` contract\ninterface IVeANGLE {\n // solhint-disable-next-line func-name-mixedcase\n function deposit_for(address addr, uint256 amount) external;\n}\n" + }, + "contracts/mock/MockAngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../implementations/mainnet/AngleRouterMainnet.sol\";\n\ncontract MockAngleRouterMainnet is AngleRouterMainnet {\n address public veAngle;\n\n function setAngleAndVeANGLE(address _veAngle) external {\n veAngle = _veAngle;\n }\n\n function _getVeANGLE() internal view override returns (IVeANGLE) {\n return IVeANGLE(veAngle);\n }\n\n function addStableMaster(IERC20 stablecoin, IStableMasterFront stableMaster) external {\n mapStableMasters[stablecoin] = stableMaster;\n }\n\n function addPairs(\n IERC20[] calldata stablecoins,\n IPoolManager[] calldata poolManagers,\n ILiquidityGauge[] calldata liquidityGauges,\n bool[] calldata justLiquidityGauges\n ) external {\n for (uint256 i; i < stablecoins.length; ++i) {\n IStableMasterFront stableMaster = mapStableMasters[stablecoins[i]];\n _addPair(stableMaster, poolManagers[i], liquidityGauges[i], justLiquidityGauges[i]);\n }\n }\n\n function _addPair(\n IStableMasterFront stableMaster,\n IPoolManager poolManager,\n ILiquidityGauge liquidityGauge,\n bool justLiquidityGauge\n ) internal {\n // Fetching the associated `sanToken` and `perpetualManager` from the contract\n (\n IERC20 collateral,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n ,\n ,\n ,\n ,\n ,\n\n ) = stableMaster.collateralMap(poolManager);\n // Reverting if the poolManager is not a valid `poolManager`\n if (address(collateral) == address(0)) revert InvalidParams();\n Pairs storage _pairs = mapPoolManagers[stableMaster][collateral];\n if (justLiquidityGauge) {\n // Cannot specify a liquidity gauge if the associated poolManager does not exist\n if (address(_pairs.poolManager) == address(0)) revert ZeroAddress();\n ILiquidityGauge gauge = _pairs.gauge;\n if (address(gauge) != address(0)) {\n _changeAllowance(IERC20(address(sanToken)), address(gauge), 0);\n }\n } else {\n // Checking if the pair has not already been initialized: if yes we need to make the function revert\n // otherwise we could end up with still approved `PoolManager` and `PerpetualManager` contracts\n if (address(_pairs.poolManager) != address(0)) revert InvalidParams();\n _pairs.poolManager = poolManager;\n _pairs.perpetualManager = IPerpetualManagerFrontWithClaim(address(perpetualManager));\n _pairs.sanToken = sanToken;\n _changeAllowance(collateral, address(stableMaster), type(uint256).max);\n _changeAllowance(collateral, address(perpetualManager), type(uint256).max);\n }\n _pairs.gauge = liquidityGauge;\n if (address(liquidityGauge) != address(0)) {\n if (address(sanToken) != liquidityGauge.staking_token()) revert InvalidParams();\n _changeAllowance(IERC20(address(sanToken)), address(liquidityGauge), type(uint256).max);\n }\n }\n}\n\ncontract MockAngleRouterMainnet2 is AngleRouterMainnet {\n function getVeANGLE() external view returns (IVeANGLE) {\n return _getVeANGLE();\n }\n}\n" + }, + "contracts/mock/MockRouterSidechain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/external/IWETH9.sol\";\n\nimport \"../BaseRouter.sol\";\n\n/// @title MockRouterSidechain\n/// @author Angle Core Team\n/// @notice Mock contract but built for tests as if to be deployed on Ethereum\ncontract MockRouterSidechain is BaseRouter {\n IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function _wrapNative() internal pure override returns (uint256) {\n return 0;\n }\n\n function _unwrapNative(uint256, address) internal pure override returns (uint256 amount) {\n return 0;\n }\n\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return WETH;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/celo/AngleRouterCeloV3_0_Implementation.json b/deployments/celo/AngleRouterCeloV3_0_Implementation.json new file mode 100644 index 0000000..b36f4bb --- /dev/null +++ b/deployments/celo/AngleRouterCeloV3_0_Implementation.json @@ -0,0 +1,618 @@ +{ + "address": "0x05225a6416EDaeeC7227027E86F7A47D18A06b91", + "abi": [ + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReturnMessage", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferredDeposit", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "spenders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "changeAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit4626Referral", + "outputs": [ + { + "internalType": "uint256", + "name": "sharesOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_uniswapRouter", + "type": "address" + }, + { + "internalType": "address", + "name": "_oneInch", + "type": "address" + } + ], + "name": "initializeRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vaultManager", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitVaultManagerType[]", + "name": "paramsPermitVaultManager", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixerVaultManagerPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "oneInch", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "_core", + "type": "address" + } + ], + "name": "setCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "internalType": "uint8", + "name": "who", + "type": "uint8" + } + ], + "name": "setRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "uniswapV3Router", + "outputs": [ + { + "internalType": "contract IUniswapV3Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xf8eb544cdf98771398a9b0744fe46177e8449128bc8218fa94630b9e7ef84f4a", + "receipt": { + "to": null, + "from": "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701", + "contractAddress": "0x05225a6416EDaeeC7227027E86F7A47D18A06b91", + "transactionIndex": 1, + "gasUsed": "3551034", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x30abe6a0e31073aad2bf0cf7c20b7bd8f6e1da867dcfc4937347650b8cbe96a6", + "transactionHash": "0xf8eb544cdf98771398a9b0744fe46177e8449128bc8218fa94630b9e7ef84f4a", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 25583688, + "transactionHash": "0xf8eb544cdf98771398a9b0744fe46177e8449128bc8218fa94630b9e7ef84f4a", + "address": "0x05225a6416EDaeeC7227027E86F7A47D18A06b91", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 1, + "blockHash": "0x30abe6a0e31073aad2bf0cf7c20b7bd8f6e1da867dcfc4937347650b8cbe96a6" + } + ], + "blockNumber": 25583688, + "cumulativeGasUsed": "3627076", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0d1b1c94fd2e1964436c8b9a0e25c545", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReturnMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApprovedOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferredDeposit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"spenders\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"changeAllowance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minSharesOut\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"deposit4626Referral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sharesOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_uniswapRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oneInch\",\"type\":\"address\"}],\"name\":\"initializeRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"vaultManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitVaultManagerType[]\",\"name\":\"paramsPermitVaultManager\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixerVaultManagerPermit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oneInch\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"setCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"who\",\"type\":\"uint8\"}],\"name\":\"setRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV3Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Router\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"params\":{\"amounts\":\"Amounts to allow\",\"spenders\":\"Addresses to allow transfer\",\"tokens\":\"Addresses of the tokens to allow\"}},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens\",\"params\":{\"actions\":\"List of actions to be performed by the router (in order of execution)\",\"data\":\"Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored\",\"paramsPermit\":\"Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\"}},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option\",\"params\":{\"paramsPermitVaultManager\":\"Parameters to sign permit to give allowance to the router for a `VaultManager` contract\"}}},\"title\":\"AngleRouterCelo\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"notice\":\"Changes allowances for different tokens\"},\"core()\":{\"notice\":\"Core address handling access control\"},\"deposit4626Referral(address,address,uint256,address,uint256,address)\":{\"notice\":\"Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract\"},\"initializeRouter(address,address,address)\":{\"notice\":\"Deploys the router contract on a chain\"},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Allows composable calls to different functions within the protocol\"},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions\"},\"oneInch()\":{\"notice\":\"Address of 1Inch router used for swaps\"},\"setCore(address)\":{\"notice\":\"Sets a new `core` contract\"},\"setRouter(address,uint8)\":{\"notice\":\"Sets a new router variable\"},\"uniswapV3Router()\":{\"notice\":\"Address of the router used for swaps\"}},\"notice\":\"Router contract built specifially for Angle use cases on Celo\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/implementations/celo/AngleRouterCelo.sol\":\"AngleRouterCelo\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x9750c6fec736eb3320e85924f36a3060fa4a4ab1758d06d9585e175d164eefdb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\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 IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\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 require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\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 */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\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. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"contracts/BaseRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport \\\"./interfaces/external/uniswap/IUniswapRouter.sol\\\";\\nimport \\\"./interfaces/external/IWETH9.sol\\\";\\nimport \\\"./interfaces/ICoreBorrow.sol\\\";\\nimport \\\"./interfaces/IDepositWithReferral.sol\\\";\\nimport \\\"./interfaces/ILiquidityGauge.sol\\\";\\nimport \\\"./interfaces/ISwapper.sol\\\";\\nimport \\\"./interfaces/IVaultManager.sol\\\";\\n\\n// ============================== STRUCTS AND ENUM =============================\\n\\n/// @notice Action types\\nenum ActionType {\\n transfer,\\n wrapNative,\\n unwrapNative,\\n sweep,\\n sweepNative,\\n // Deprecated\\n uniswapV3,\\n oneInch,\\n claimRewards,\\n // Deprecated\\n gaugeDeposit,\\n borrower,\\n swapper,\\n mint4626,\\n deposit4626,\\n redeem4626,\\n withdraw4626,\\n // Deprecated\\n prepareRedeemSavingsRate,\\n // Deprecated\\n claimRedeemSavingsRate,\\n // Deprecated\\n swapIn,\\n // Deprecated\\n swapOut,\\n claimWeeklyInterest,\\n // Deprecated\\n withdraw,\\n // Deprecated\\n mint,\\n // Deprecated\\n deposit,\\n // Deprecated\\n openPerpetual,\\n // Deprecated\\n addToPerpetual,\\n veANGLEDeposit,\\n // Deprecated\\n claimRewardsWithPerps,\\n deposit4626Referral\\n}\\n\\n/// @notice Data needed to get permits\\nstruct PermitType {\\n address token;\\n address owner;\\n uint256 value;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @notice Data to grant permit to the router for a vault\\nstruct PermitVaultManagerType {\\n address vaultManager;\\n address owner;\\n bool approved;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @title BaseRouter\\n/// @author Angle Core Team\\n/// @notice Base contract that Angle router contracts on different chains should override\\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\\n using SafeERC20 for IERC20;\\n\\n // ================================= REFERENCES ================================\\n\\n /// @notice Core address handling access control\\n ICoreBorrow public core;\\n /// @notice Address of the router used for swaps\\n IUniswapV3Router public uniswapV3Router;\\n /// @notice Address of 1Inch router used for swaps\\n address public oneInch;\\n\\n uint256[47] private __gap;\\n\\n // ============================== EVENTS / ERRORS ==============================\\n\\n error IncompatibleLengths();\\n error InvalidReturnMessage();\\n error NotApprovedOrOwner();\\n error NotGovernor();\\n error NotGovernorOrGuardian();\\n error TooSmallAmountOut();\\n error TransferFailed();\\n error ZeroAddress();\\n\\n event ReferredDeposit(\\n address caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares,\\n address indexed savings,\\n address indexed referrer\\n );\\n\\n /// @notice Deploys the router contract on a chain\\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\\n if (_core == address(0)) revert ZeroAddress();\\n core = ICoreBorrow(_core);\\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\\n oneInch = _oneInch;\\n }\\n\\n constructor() initializer {}\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @notice Allows composable calls to different functions within the protocol\\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\\n /// @param actions List of actions to be performed by the router (in order of execution)\\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\\n /// for a given action are stored\\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\\n /// do not perform a sweep action on these tokens\\n function mixer(\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) public payable virtual {\\n // If all tokens have already been approved, there's no need for this step\\n uint256 permitsLength = paramsPermit.length;\\n for (uint256 i; i < permitsLength; ++i) {\\n IERC20Permit(paramsPermit[i].token).permit(\\n paramsPermit[i].owner,\\n address(this),\\n paramsPermit[i].value,\\n paramsPermit[i].deadline,\\n paramsPermit[i].v,\\n paramsPermit[i].r,\\n paramsPermit[i].s\\n );\\n }\\n // Performing actions one after the others\\n uint256 actionsLength = actions.length;\\n for (uint256 i; i < actionsLength; ++i) {\\n if (actions[i] == ActionType.transfer) {\\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\\n } else if (actions[i] == ActionType.wrapNative) {\\n _wrapNative();\\n } else if (actions[i] == ActionType.unwrapNative) {\\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\\n _unwrapNative(minAmountOut, to);\\n } else if (actions[i] == ActionType.sweep) {\\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\\n _sweep(tokenOut, minAmountOut, to);\\n } else if (actions[i] == ActionType.sweepNative) {\\n uint256 routerBalance = address(this).balance;\\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\\n } else if (actions[i] == ActionType.oneInch) {\\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\\n data[i],\\n (address, uint256, bytes)\\n );\\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\\n } else if (actions[i] == ActionType.claimRewards) {\\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\\n _claimRewards(user, claimLiquidityGauges);\\n } else if (actions[i] == ActionType.borrower) {\\n (\\n address collateral,\\n address vaultManager,\\n address to,\\n address who,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n bytes memory repayData\\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\\n } else if (actions[i] == ActionType.swapper) {\\n (\\n ISwapper swapperContract,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory payload\\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\\n } else if (actions[i] == ActionType.mint4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _mint4626(savingsRate, shares, to, maxAmountIn);\\n } else if (actions[i] == ActionType.deposit4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626(savingsRate, amount, to, minSharesOut);\\n } else if (actions[i] == ActionType.deposit4626Referral) {\\n (\\n IERC20 token,\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\\n } else if (actions[i] == ActionType.redeem4626) {\\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _redeem4626(savingsRate, shares, to, minAmountOut);\\n } else if (actions[i] == ActionType.withdraw4626) {\\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\\n } else {\\n _chainSpecificAction(actions[i], data[i]);\\n }\\n }\\n }\\n\\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\\n /// addresses depositing from a certain referring address into an ERC4626 contract\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut) {\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n _changeAllowance(IERC20(token), savings, type(uint256).max);\\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\\n }\\n\\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\\n /// actions and then revoking this approval after these actions\\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\\n /// to revoke approvals\\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\\n /// is just an option\\n function mixerVaultManagerPermit(\\n PermitVaultManagerType[] memory paramsPermitVaultManager,\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) external payable virtual {\\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n true,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n } else break;\\n }\\n mixer(paramsPermit, actions, data);\\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\\n // too deep\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (!paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n false,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n }\\n }\\n }\\n\\n receive() external payable {}\\n\\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\\n\\n /// @notice Wraps the native token of a chain to its wrapped version\\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\\n /// @dev The amount to wrap is to be specified in the `msg.value`\\n function _wrapNative() internal virtual returns (uint256) {\\n _getNativeWrapper().deposit{ value: msg.value }();\\n return msg.value;\\n }\\n\\n /// @notice Unwraps the wrapped version of a token to the native chain token\\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\\n amount = _getNativeWrapper().balanceOf(address(this));\\n _slippageCheck(amount, minAmountOut);\\n if (amount != 0) {\\n _getNativeWrapper().withdraw(amount);\\n _safeTransferNative(to, amount);\\n }\\n return amount;\\n }\\n\\n /// @notice Internal version of the `claimRewards` function\\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\\n uint256 gaugesLength = liquidityGauges.length;\\n for (uint256 i; i < gaugesLength; ++i) {\\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\\n }\\n }\\n\\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\\n /// @param vaultManager Address of the vault to perform actions on\\n /// @param actionsBorrow Actions type to perform on the vaultManager\\n /// @param dataBorrow Data needed for each actions\\n /// @param to Address to send the funds to\\n /// @param who Swapper address to handle repayments\\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\\n function _angleBorrower(\\n address vaultManager,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address to,\\n address who,\\n bytes memory repayData\\n ) internal virtual returns (PaymentData memory paymentData) {\\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\\n }\\n\\n /// @notice Sweeps tokens from the router contract\\n /// @param tokenOut Token to sweep\\n /// @param minAmountOut Minimum amount of tokens to recover\\n /// @param to Address to which tokens should be sent\\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\\n _slippageCheck(balanceToken, minAmountOut);\\n if (balanceToken != 0) {\\n IERC20(tokenOut).safeTransfer(to, balanceToken);\\n }\\n }\\n\\n /// @notice Uses an external swapper\\n /// @param swapper Contracts implementing the logic of the swap\\n /// @param inToken Token used to do the swap\\n /// @param outToken Token wanted\\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\\n /// @param inTokenObtained Amount of `inToken` used for the swap\\n /// @param data Additional info for the specific swapper\\n function _swapper(\\n ISwapper swapper,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) internal {\\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\\n }\\n\\n /// @notice Swaps an inToken to another token via 1Inch Router\\n /// @param payload Bytes needed for 1Inch router to process the swap\\n /// @dev The `payload` given is expected to be obtained from 1Inch API\\n function _swapOn1Inch(\\n IERC20 inToken,\\n uint256 minAmountOut,\\n bytes memory payload\\n ) internal returns (uint256 amountOut) {\\n // Approve transfer to the `oneInch` address\\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\\n address oneInchRouter = oneInch;\\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\\n //solhint-disable-next-line\\n (bool success, bytes memory result) = oneInchRouter.call(payload);\\n if (!success) _revertBytes(result);\\n\\n amountOut = abi.decode(result, (uint256));\\n _slippageCheck(amountOut, minAmountOut);\\n }\\n\\n /// @notice Mints `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to mint shares from\\n /// @param shares Amount of shares to mint from the contract\\n /// @param to Address to which shares should be sent\\n /// @param maxAmountIn Max amount of assets used to mint\\n /// @return amountIn Amount of assets used to mint by `to`\\n function _mint4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 maxAmountIn\\n ) internal returns (uint256 amountIn) {\\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\\n }\\n\\n /// @notice Deposits `amount` to an ERC4626 contract\\n /// @param savingsRate The ERC4626 to deposit assets to\\n /// @param amount Amount of assets to deposit\\n /// @param to Address to which shares should be sent\\n /// @param minSharesOut Minimum amount of shares that `to` should received\\n /// @return sharesOut Amount of shares received by `to`\\n function _deposit4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\\n }\\n\\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\\n function _deposit4626Referral(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) internal returns (uint256 sharesOut) {\\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\\n }\\n\\n /// @notice Withdraws `amount` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to withdraw assets from\\n /// @param amount Amount of assets to withdraw\\n /// @param to Destination of assets\\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\\n /// @return sharesOut Amount of shares burnt\\n function _withdraw4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 maxSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\\n }\\n\\n /// @notice Redeems `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to redeem shares from\\n /// @param shares Amount of shares to redeem\\n /// @param to Destination of assets\\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\\n /// @return amountOut Amount of assets received by `to`\\n function _redeem4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 minAmountOut\\n ) internal returns (uint256 amountOut) {\\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\\n }\\n\\n /// @notice Allows to perform some specific actions for a chain\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\\n\\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\\n\\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\\n\\n // ============================ GOVERNANCE FUNCTION ============================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Sets a new `core` contract\\n function setCore(ICoreBorrow _core) external {\\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\\n core = ICoreBorrow(_core);\\n }\\n\\n /// @notice Changes allowances for different tokens\\n /// @param tokens Addresses of the tokens to allow\\n /// @param spenders Addresses to allow transfer\\n /// @param amounts Amounts to allow\\n function changeAllowance(\\n IERC20[] calldata tokens,\\n address[] calldata spenders,\\n uint256[] calldata amounts\\n ) external onlyGovernorOrGuardian {\\n uint256 tokensLength = tokens.length;\\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\\n for (uint256 i; i < tokensLength; ++i) {\\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\\n }\\n }\\n\\n /// @notice Sets a new router variable\\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\\n if (router == address(0)) revert ZeroAddress();\\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\\n else oneInch = router;\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Changes allowance of this contract for a given token\\n /// @param token Address of the token to change allowance\\n /// @param spender Address to change the allowance of\\n /// @param amount Amount allowed\\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\\n } else if (currentAllowance > amount) {\\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\\n }\\n }\\n\\n /// @notice Transfer amount of the native token to the `to` address\\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\\n function _safeTransferNative(address to, uint256 amount) internal {\\n bool success;\\n //solhint-disable-next-line\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n if (!success) revert TransferFailed();\\n }\\n\\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\\n /// the calling address is well approved for all the vaults with which it is interacting\\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\\n /// with a vault are approved for this vault\\n function _parseVaultIDs(\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address vaultManager,\\n address collateral\\n ) internal view returns (bytes[] memory) {\\n uint256 actionsBorrowLength = actionsBorrow.length;\\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\\n bool createVaultAction;\\n uint256 lastVaultID;\\n uint256 vaultIDLength;\\n for (uint256 i; i < actionsBorrowLength; ++i) {\\n uint256 vaultID;\\n // If there is a `createVault` action, the router should not worry about looking at\\n // next vaultIDs given equal to 0\\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\\n createVaultAction = true;\\n continue;\\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\\n // as collateral the full contract balance\\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\\n uint256 amount;\\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\\n if (amount == type(uint256).max)\\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\\n continue;\\n // There are different ways depending on the action to find the `vaultID` to parse\\n } else if (\\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\\n ) {\\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\\n vaultID = abi.decode(dataBorrow[i], (uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\\n } else continue;\\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\\n // if there has not been any specific action\\n if (vaultID == 0) {\\n if (createVaultAction) {\\n continue;\\n } else {\\n // If we haven't stored the last `vaultID`, we need to fetch it\\n if (lastVaultID == 0) {\\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\\n }\\n vaultID = lastVaultID;\\n }\\n }\\n\\n // Check if this `vaultID` has already been verified\\n for (uint256 j; j < vaultIDLength; ++j) {\\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\\n // If yes, we continue to the next iteration\\n continue;\\n }\\n }\\n // Verify this new `vaultID` and add it to the list\\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\\n revert NotApprovedOrOwner();\\n }\\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\\n vaultIDLength += 1;\\n }\\n return dataBorrow;\\n }\\n\\n /// @notice Checks whether the amount obtained during a swap is not too small\\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\\n if (amount < thresholdAmount) revert TooSmallAmountOut();\\n }\\n\\n /// @notice Internal function used for error handling\\n function _revertBytes(bytes memory errMsg) internal pure {\\n if (errMsg.length != 0) {\\n //solhint-disable-next-line\\n assembly {\\n revert(add(32, errMsg), mload(errMsg))\\n }\\n }\\n revert InvalidReturnMessage();\\n }\\n}\\n\",\"keccak256\":\"0x5b45e51240ed42ae858c34a0e7e15003885bd998d3a47da7a4fa5604b69f5c2f\",\"license\":\"GPL-3.0\"},\"contracts/implementations/celo/AngleRouterCelo.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"../../BaseRouter.sol\\\";\\n\\n/// @title AngleRouterCelo\\n/// @author Angle Core Team\\n/// @notice Router contract built specifially for Angle use cases on Celo\\ncontract AngleRouterCelo is BaseRouter {\\n /// @inheritdoc BaseRouter\\n /// @dev There is no wCELO contract on CELO\\n function _getNativeWrapper() internal pure override returns (IWETH9) {\\n return IWETH9(0x0000000000000000000000000000000000000000);\\n }\\n}\\n\",\"keccak256\":\"0xe3a6747c543151ba5bebe680a2addd800de4c5fb68c81553814f6c3d7a191e2d\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ICoreBorrow.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICoreBorrow\\n/// @author Angle Core Team\\n/// @notice Interface for the `CoreBorrow` contract\\n\\ninterface ICoreBorrow {\\n /// @notice Checks whether an address is governor of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2414539c445977b04bc7e9adac2e5147364994dd74e5d7118b44824956de602c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDepositWithReferral.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IDepositWithReferral\\n/// @author Angle Core Team\\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\\ninterface IDepositWithReferral {\\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\\n /// obtained, the function reverts\\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\\n /// when a deposit takes place\\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut);\\n}\\n\",\"keccak256\":\"0x69b88fa9ec5111394843f54f312c3b8c1b47490c76109a97ba90e4ac5697e960\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ILiquidityGauge.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface ILiquidityGauge {\\n // solhint-disable-next-line\\n function staking_token() external returns (address stakingToken);\\n\\n // solhint-disable-next-line\\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\\n\\n function deposit(\\n uint256 _value,\\n address _addr,\\n // solhint-disable-next-line\\n bool _claim_rewards\\n ) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr, address _receiver) external;\\n}\\n\",\"keccak256\":\"0x27144c21760603a4e441bb5eecf975ad7f71331ac0ba0a83352b280ccf734756\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\n/// @title ISwapper\\n/// @author Angle Core Team\\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\\ninterface ISwapper {\\n function swap(\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0x506f50d8447c2dc662bd844779cc66a407af07a91210612b956ef47abcc15776\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITreasury.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ITreasury\\n/// @author Angle Core Team\\n/// @notice Interface for the `Treasury` contract\\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\\n/// of this module\\ninterface ITreasury {\\n /// @notice Checks whether a given address has well been initialized in this contract\\n /// as a `VaultManager``\\n /// @param _vaultManager Address to check\\n /// @return Whether the address has been initialized or not\\n function isVaultManager(address _vaultManager) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x36bd50a0ab1c46503bb64b8d5777bf3b4fd2da0e2dcfe68c8a9702eb132eb3e2\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVaultManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./ITreasury.sol\\\";\\n\\n// ========================= Key Structs and Enums =============================\\n\\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\\n/// to the caller or associated addresses\\nstruct PaymentData {\\n // Stablecoin amount the contract should give\\n uint256 stablecoinAmountToGive;\\n // Stablecoin amount owed to the contract\\n uint256 stablecoinAmountToReceive;\\n // Collateral amount the contract should give\\n uint256 collateralAmountToGive;\\n // Collateral amount owed to the contract\\n uint256 collateralAmountToReceive;\\n}\\n\\n/// @notice Data stored to track someone's loan (or equivalently called position)\\nstruct Vault {\\n // Amount of collateral deposited in the vault\\n uint256 collateralAmount;\\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\\n uint256 normalizedDebt;\\n}\\n\\n/// @notice Actions possible when composing calls to the different entry functions proposed\\nenum ActionBorrowType {\\n createVault,\\n closeVault,\\n addCollateral,\\n removeCollateral,\\n repayDebt,\\n borrow,\\n getDebtIn,\\n permit\\n}\\n\\n// ========================= Interfaces =============================\\n\\n/// @title IVaultManagerFunctions\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface only contains functions of the contract which are called by other contracts\\n/// of this module (without getters)\\ninterface IVaultManagerFunctions {\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\\n /// @param repayData Data to pass to the repayment contract in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to,\\n address who,\\n bytes memory repayData\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Checks whether a given address is approved for a vault or owns this vault\\n /// @param spender Address for which vault ownership should be checked\\n /// @param vaultID ID of the vault to check\\n /// @return Whether the `spender` address owns or is approved for `vaultID`\\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\\n\\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\\n /// @param spender Address to give approval to\\n /// @param approved Whether to give or revoke the approval\\n /// @param deadline Deadline parameter for the signature to be valid\\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\\n function permit(\\n address owner,\\n address spender,\\n bool approved,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\\n/// @title IVaultManagerStorage\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface contains getters of the contract's public variables used by other contracts\\n/// of this module\\ninterface IVaultManagerStorage {\\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\\n function treasury() external view returns (ITreasury);\\n\\n /// @notice Reference to the collateral handled by this `VaultManager`\\n function collateral() external view returns (IERC20);\\n\\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\\n function vaultIDCount() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4cf6dc5e5b494165e4d9e524dca5c65f6307e5b005a62287c5e84f1539dc81f1\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title Interface for WETH9\\ninterface IWETH9 is IERC20 {\\n /// @notice Deposit ether to get wrapped ether\\n function deposit() external payable;\\n\\n /// @notice Withdraw wrapped ether to get ether\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0xb109c1d668416c05f61d6edea2ec7a10b2f8b386fd51a59cc12f929c73d00424\",\"license\":\"GPL-2.0-or-later\"},\"contracts/interfaces/external/uniswap/IUniswapRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nstruct ExactInputParams {\\n bytes path;\\n address recipient;\\n uint256 deadline;\\n uint256 amountIn;\\n uint256 amountOutMinimum;\\n}\\n\\n/// @title Router token swapping functionality\\n/// @notice Functions for swapping tokens via Uniswap V3\\ninterface IUniswapV3Router {\\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\\n /// @return amountOut The amount of the received token\\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\\n}\\n\\n/// @title Router for price estimation functionality\\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\\n/// @dev This interface is only used for non critical elements of the protocol\\ninterface IUniswapV2Router {\\n /// @notice Given an input asset amount, returns the maximum output amount of the\\n /// other asset (accounting for fees) given reserves.\\n /// @param path Addresses of the pools used to get prices\\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\\n\\n function swapExactTokensForTokens(\\n uint256 swapAmount,\\n uint256 minExpected,\\n address[] calldata path,\\n address receiver,\\n uint256 swapDeadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x1908fcdc6ff78ad2250f6ccacc7129df464a648cb2a5f376bedbe506d058bb73\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620018d51760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b613f17806200015c6000396000f3fe6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612ef9565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612f69565b6102b5565b005b6101936101a33660046131c9565b610520565b3480156101b457600080fd5b506101936101c336600461334f565b6108bc565b3480156101d457600080fd5b506101936101e336600461336c565b610a6e565b6101936101f63660046133a1565b610c1e565b34801561020757600080fd5b50610193610216366004613436565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134b1565b602002602001015160400151156106d357878181518110610562576105626134b1565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134b1565b6020026020010151602001513060018c86815181106105bc576105bc6134b1565b6020026020010151606001518d87815181106105da576105da6134b1565b6020026020010151608001518e88815181106105f8576105f86134b1565b602002602001015160a001518f8981518110610616576106166134b1565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161350f565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134b1565b6020026020010151604001516108a257878181518110610735576107356134b1565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134b1565b6020026020010151602001513060008c868151811061078f5761078f6134b1565b6020026020010151606001518d87815181106107ad576107ad6134b1565b6020026020010151608001518e88815181106107cb576107cb6134b1565b602002602001015160a001518f89815181106107e9576107e96134b1565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161350f565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613547565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613547565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613547565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134b1565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134b1565b602002602001015160200151308a8581518110610c9557610c956134b1565b6020026020010151604001518b8681518110610cb357610cb36134b1565b6020026020010151606001518c8781518110610cd157610cd16134b1565b6020026020010151608001518d8881518110610cef57610cef6134b1565b602002602001015160a001518e8981518110610d0d57610d0d6134b1565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061350f565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134b1565b9050602002016020810190610e0c9190613593565b601b811115610e1d57610e1d613564565b03610f40576000806000878785818110610e3957610e396134b1565b9050602002810190610e4b91906135b4565b810190610e589190613624565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190613665565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134b1565b9050602002016020810190610f699190613593565b601b811115610f7a57610f7a613564565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134b1565b9050602002016020810190610fb69190613593565b601b811115610fc757610fc7613564565b0361100e57600080868684818110610fe157610fe16134b1565b9050602002810190610ff391906135b4565b810190611000919061367e565b91509150610f388282611bef565b6003878783818110611022576110226134b1565b90506020020160208101906110379190613593565b601b81111561104857611048613564565b03611094576000806000878785818110611064576110646134b1565b905060200281019061107691906135b4565b81019061108391906136ae565b925092509250610f38838383611d0f565b60048787838181106110a8576110a86134b1565b90506020020160208101906110bd9190613593565b601b8111156110ce576110ce613564565b036110e457478015610f8757610f873382611dd3565b60068787838181106110f8576110f86134b1565b905060200201602081019061110d9190613593565b601b81111561111e5761111e613564565b0361117357600080600087878581811061113a5761113a6134b1565b905060200281019061114c91906135b4565b8101906111599190613773565b92509250925061116a838383611e18565b50505050611727565b6007878783818110611187576111876134b1565b905060200201602081019061119c9190613593565b601b8111156111ad576111ad613564565b036111fb576000808686848181106111c7576111c76134b1565b90506020028101906111d991906135b4565b8101906111e691906137cc565b915091506111f48282611f06565b5050611727565b600987878381811061120f5761120f6134b1565b90506020020160208101906112249190613593565b601b81111561123557611235613564565b036112d85760008060008060008060008b8b89818110611257576112576134b1565b905060200281019061126991906135b4565b810190611276919061396f565b96509650965096509650965096506112908383888a611fc3565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb8684848888866124f0565b5050505050505050611727565b600a8787838181106112ec576112ec6134b1565b90506020020160208101906113019190613593565b601b81111561131257611312613564565b0361137c5760008060008060008060008b8b89818110611334576113346134b1565b905060200281019061134691906135b4565b8101906113539190613a3e565b9650965096509650965096509650611370878787878787876125ba565b50505050505050611727565b600b878783818110611390576113906134b1565b90506020020160208101906113a59190613593565b601b8111156113b6576113b6613564565b036114405760008060008060008989878181106113d5576113d56134b1565b90506020028101906113e791906135b4565b8101906113f49190613aca565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612651565b505050505050611727565b600c878783818110611454576114546134b1565b90506020020160208101906114699190613593565b601b81111561147a5761147a613564565b036114f9576000806000806000898987818110611499576114996134b1565b90506020028101906114ab91906135b4565b8101906114b89190613aca565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b611435848484846126fd565b601b87878381811061150d5761150d6134b1565b90506020020160208101906115229190613593565b601b81111561153357611533613564565b036115b6576000806000806000808a8a88818110611553576115536134b1565b905060200281019061156591906135b4565b8101906115729190612ef9565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134b1565b90506020020160208101906115df9190613593565b601b8111156115f0576115f0613564565b0361164a5760008060008088888681811061160d5761160d6134b1565b905060200281019061161f91906135b4565b81019061162c9190613b25565b9350935093509350611640848484846127a7565b5050505050611727565b600e87878381811061165e5761165e6134b1565b90506020020160208101906116739190613593565b601b81111561168457611684613564565b036116d4576000806000808888868181106116a1576116a16134b1565b90506020028101906116b391906135b4565b8101906116c09190613b25565b93509350935093506116408484848461280f565b6117278787838181106116e9576116e96134b1565b90506020020160208101906116fe9190613593565b868684818110611710576117106134b1565b905060200281019061172291906135b4565b505050565b6117308161350f565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613547565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134b1565b9050602002016020810190611880919061334f565b878784818110611892576118926134b1565b90506020020160208101906118a7919061334f565b8686858181106118b9576118b96134b1565b905060200201356119cd565b6118ce8161350f565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261287a565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a679190613665565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613b6d565b81105b15611ad757611ad283611ab48385613ba8565b73ffffffffffffffffffffffffffffffffffffffff87169190612986565b61051a565b8181111561051a5761051a83611aed8484613ba8565b73ffffffffffffffffffffffffffffffffffffffff87169190612a84565b6000611b19868686866126fd565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b60008073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611bd057600080fd5b505af1158015611be4573d6000803e3d6000fd5b505050505034905090565b6000806040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c829190613665565b9050611c8e8184612c11565b8015611d09576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101829052600090632e1a7d4d90602401600060405180830381600087803b158015611ce757600080fd5b505af1158015611cfb573d6000803e3d6000fd5b50505050611d098282611dd3565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611d7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da09190613665565b9050611dac8184612c11565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c4b565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e5f85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611e879190613bdf565b6000604051808303816000865af19150503d8060008114611ec4576040519150601f19603f3d011682016040523d82523d6000602084013e611ec9565b606091505b509150915081611edc57611edc81612ca1565b80806020019051810190611ef09190613665565b9350611efc8487612c11565b5050509392505050565b805160005b8181101561051a57828181518110611f2557611f256134b1565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611f9a57600080fd5b505af1158015611fae573d6000803e3d6000fd5b5050505080611fbc9061350f565b9050611f0b565b835160609060008167ffffffffffffffff811115611fe357611fe3612fb4565b60405190808252806020026020018201604052801561200c578160200160208202803683370190505b5090506000806000805b858110156124de576000808c8381518110612033576120336134b1565b6020026020010151600781111561204c5761204c613564565b0361205b5760019450506124ce565b60028c838151811061206f5761206f6134b1565b6020026020010151600781111561208857612088613564565b0361219f5760008b83815181106120a1576120a16134b1565b60200260200101518060200190518101906120bc9190613bfb565b909250905060018101612198576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612135573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121599190613665565b6040805160208101939093528201526060016040516020818303038152906040528c848151811061218c5761218c6134b1565b60200260200101819052505b50506124ce565b60038c83815181106121b3576121b36134b1565b602002602001015160078111156121cc576121cc613564565b1480612202575060058c83815181106121e7576121e76134b1565b6020026020010151600781111561220057612200613564565b145b1561223c578a8281518110612219576122196134b1565b60200260200101518060200190518101906122349190613bfb565b509050612313565b60018c8381518110612250576122506134b1565b6020026020010151600781111561226957612269613564565b036122a2578a8281518110612280576122806134b1565b602002602001015180602001905181019061229b9190613665565b9050612313565b60068c83815181106122b6576122b66134b1565b602002602001015160078111156122cf576122cf613564565b0361230d578a82815181106122e6576122e66134b1565b60200260200101518060200190518101906123019190613c1f565b50919250612313915050565b506124ce565b806000036123a457841561232757506124ce565b836000036123a1578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561237a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239e9190613665565b93505b50825b60005b838110156123d557818782815181106123c2576123c26134b1565b5050506123ce8161350f565b90506123a7565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061246b9190613547565b6124a1576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124b4576124b46134b1565b60209081029190910101526124ca600184613c5d565b9250505b6124d78161350f565b9050612016565b5088955050505050505b949350505050565b61251b6040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc69890612577908990899033908a908a908a90600401613d0f565b6080604051808303816000875af1158015612596573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e0f565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061261690899089908990899089908990600401613e75565b600060405180830381600087803b15801561263057600080fd5b505af1158015612644573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301526000916124e8918491908816906394bf804d906044015b6020604051808303816000875af11580156126d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126f59190613665565b925082612c11565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301526000916124e891871690636e553f65906044015b6020604051808303816000875af115801561277a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279e9190613665565b91508183612c11565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916124e89187169063ba0876529060640161275b565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916124e89184919088169063b460af94906064016126b2565b60006128dc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612ce29092919063ffffffff16565b80519091501561172257808060200190518101906128fa9190613547565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156129fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a219190613665565b612a2b9190613c5d565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612afa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b1e9190613665565b905081811015612bb0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c0a9086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612cb057805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612cf18484600085612cfb565b90505b9392505050565b606082471015612d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e349190613bdf565b60006040518083038185875af1925050503d8060008114612e71576040519150601f19603f3d011682016040523d82523d6000602084013e612e76565b606091505b50915091506102aa82828660608315612e90575081612cf4565b825115612ea05782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613ece565b73ffffffffffffffffffffffffffffffffffffffff81168114612ef657600080fd5b50565b60008060008060008060c08789031215612f1257600080fd5b8635612f1d81612ed4565b95506020870135612f2d81612ed4565b9450604087013593506060870135612f4481612ed4565b92506080870135915060a0870135612f5b81612ed4565b809150509295509295509295565b600080600060608486031215612f7e57600080fd5b8335612f8981612ed4565b92506020840135612f9981612ed4565b91506040840135612fa981612ed4565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561300657613006612fb4565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561305357613053612fb4565b604052919050565b600067ffffffffffffffff82111561307557613075612fb4565b5060051b60200190565b8015158114612ef657600080fd5b803560ff8116811461309e57600080fd5b919050565b600082601f8301126130b457600080fd5b813560206130c96130c48361305b565b61300c565b82815260e092830285018201928282019190878511156130e857600080fd5b8387015b858110156131705781818a0312156131045760008081fd5b61310c612fe3565b813561311781612ed4565b81528186013561312681612ed4565b818701526040828101359082015260608083013590820152608061314b81840161308d565b9082015260a0828101359082015260c0808301359082015284529284019281016130ec565b5090979650505050505050565b60008083601f84011261318f57600080fd5b50813567ffffffffffffffff8111156131a757600080fd5b6020830191508360208260051b85010111156131c257600080fd5b9250929050565b600080600080600080608087890312156131e257600080fd5b863567ffffffffffffffff808211156131fa57600080fd5b818901915089601f83011261320e57600080fd5b8135602061321e6130c48361305b565b82815260e09092028401810191818101908d84111561323c57600080fd5b948201945b838610156132d35760e0868f03121561325a5760008081fd5b613262612fe3565b863561326d81612ed4565b81528684013561327c81612ed4565b8185015260408781013561328f8161307f565b90820152606087810135908201526132a96080880161308d565b608082015260a0878101359082015260c08088013590820152825260e09095019490820190613241565b9a50508a0135925050808211156132e957600080fd5b6132f58a838b016130a3565b9650604089013591508082111561330b57600080fd5b6133178a838b0161317d565b9096509450606089013591508082111561333057600080fd5b5061333d89828a0161317d565b979a9699509497509295939492505050565b60006020828403121561336157600080fd5b8135612cf481612ed4565b6000806040838503121561337f57600080fd5b823561338a81612ed4565b91506133986020840161308d565b90509250929050565b6000806000806000606086880312156133b957600080fd5b853567ffffffffffffffff808211156133d157600080fd5b6133dd89838a016130a3565b965060208801359150808211156133f357600080fd5b6133ff89838a0161317d565b9096509450604088013591508082111561341857600080fd5b506134258882890161317d565b969995985093965092949392505050565b6000806000806000806060878903121561344f57600080fd5b863567ffffffffffffffff8082111561346757600080fd5b6134738a838b0161317d565b9098509650602089013591508082111561348c57600080fd5b6134988a838b0161317d565b9096509450604089013591508082111561333057600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613540576135406134e0565b5060010190565b60006020828403121561355957600080fd5b8151612cf48161307f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135a557600080fd5b8135601c8110612cf457600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126135e957600080fd5b83018035915067ffffffffffffffff82111561360457600080fd5b6020019150368190038213156131c257600080fd5b803561309e81612ed4565b60008060006060848603121561363957600080fd5b833561364481612ed4565b9250602084013561365481612ed4565b929592945050506040919091013590565b60006020828403121561367757600080fd5b5051919050565b6000806040838503121561369157600080fd5b8235915060208301356136a381612ed4565b809150509250929050565b6000806000606084860312156136c357600080fd5b83356136ce81612ed4565b9250602084013591506040840135612fa981612ed4565b600082601f8301126136f657600080fd5b813567ffffffffffffffff81111561371057613710612fb4565b61374160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161300c565b81815284602083860101111561375657600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561378857600080fd5b833561379381612ed4565b925060208401359150604084013567ffffffffffffffff8111156137b657600080fd5b6137c2868287016136e5565b9150509250925092565b600080604083850312156137df57600080fd5b82356137ea81612ed4565b915060208381013567ffffffffffffffff81111561380757600080fd5b8401601f8101861361381857600080fd5b80356138266130c48261305b565b81815260059190911b8201830190838101908883111561384557600080fd5b928401925b8284101561386c57833561385d81612ed4565b8252928401929084019061384a565b80955050505050509250929050565b600082601f83011261388c57600080fd5b8135602061389c6130c48361305b565b82815260059290921b840181019181810190868411156138bb57600080fd5b8286015b848110156138e4578035600881106138d75760008081fd5b83529183019183016138bf565b509695505050505050565b600082601f83011261390057600080fd5b813560206139106130c48361305b565b82815260059290921b8401810191818101908684111561392f57600080fd5b8286015b848110156138e457803567ffffffffffffffff8111156139535760008081fd5b6139618986838b01016136e5565b845250918301918301613933565b600080600080600080600060e0888a03121561398a57600080fd5b873561399581612ed4565b965060208801356139a581612ed4565b95506139b360408901613619565b94506139c160608901613619565b9350608088013567ffffffffffffffff808211156139de57600080fd5b6139ea8b838c0161387b565b945060a08a0135915080821115613a0057600080fd5b613a0c8b838c016138ef565b935060c08a0135915080821115613a2257600080fd5b50613a2f8a828b016136e5565b91505092959891949750929550565b600080600080600080600060e0888a031215613a5957600080fd5b8735613a6481612ed4565b96506020880135613a7481612ed4565b95506040880135613a8481612ed4565b94506060880135613a9481612ed4565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613abe57600080fd5b613a2f8a828b016136e5565b600080600080600060a08688031215613ae257600080fd5b8535613aed81612ed4565b94506020860135613afd81612ed4565b9350604086013592506060860135613b1481612ed4565b949793965091946080013592915050565b60008060008060808587031215613b3b57600080fd5b8435613b4681612ed4565b9350602085013592506040850135613b5d81612ed4565b9396929550929360600135925050565b600082613ba3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d0957611d096134e0565b60005b83811015613bd6578181015183820152602001613bbe565b50506000910152565b60008251613bf1818460208701613bbb565b9190910192915050565b60008060408385031215613c0e57600080fd5b505080516020909101519092909150565b60008060008060808587031215613c3557600080fd5b845193506020850151613c4781612ed4565b6040860151606090960151949790965092505050565b80820180821115611d0957611d096134e0565b60008151808452613c88816020860160208601613bbb565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d02578284038952613cf0848351613c70565b98850198935090840190600101613cd8565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613d7e57825160088110613d6c577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d2d565b5050505083810382850152613d93818a613cba565b915050613db8604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e028185613c70565b9998505050505050505050565b600060808284031215613e2157600080fd5b6040516080810181811067ffffffffffffffff82111715613e4457613e44612fb4565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613ec260c0830184613c70565b98975050505050505050565b602081526000612cf46020830184613c7056fea26469706673582212205658029a519003a8ee0f66e313233baa1bbca7b8eabd724e22422f76699d475364736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612ef9565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612f69565b6102b5565b005b6101936101a33660046131c9565b610520565b3480156101b457600080fd5b506101936101c336600461334f565b6108bc565b3480156101d457600080fd5b506101936101e336600461336c565b610a6e565b6101936101f63660046133a1565b610c1e565b34801561020757600080fd5b50610193610216366004613436565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134b1565b602002602001015160400151156106d357878181518110610562576105626134b1565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134b1565b6020026020010151602001513060018c86815181106105bc576105bc6134b1565b6020026020010151606001518d87815181106105da576105da6134b1565b6020026020010151608001518e88815181106105f8576105f86134b1565b602002602001015160a001518f8981518110610616576106166134b1565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161350f565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134b1565b6020026020010151604001516108a257878181518110610735576107356134b1565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134b1565b6020026020010151602001513060008c868151811061078f5761078f6134b1565b6020026020010151606001518d87815181106107ad576107ad6134b1565b6020026020010151608001518e88815181106107cb576107cb6134b1565b602002602001015160a001518f89815181106107e9576107e96134b1565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161350f565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613547565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613547565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613547565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134b1565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134b1565b602002602001015160200151308a8581518110610c9557610c956134b1565b6020026020010151604001518b8681518110610cb357610cb36134b1565b6020026020010151606001518c8781518110610cd157610cd16134b1565b6020026020010151608001518d8881518110610cef57610cef6134b1565b602002602001015160a001518e8981518110610d0d57610d0d6134b1565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061350f565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134b1565b9050602002016020810190610e0c9190613593565b601b811115610e1d57610e1d613564565b03610f40576000806000878785818110610e3957610e396134b1565b9050602002810190610e4b91906135b4565b810190610e589190613624565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f139190613665565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134b1565b9050602002016020810190610f699190613593565b601b811115610f7a57610f7a613564565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134b1565b9050602002016020810190610fb69190613593565b601b811115610fc757610fc7613564565b0361100e57600080868684818110610fe157610fe16134b1565b9050602002810190610ff391906135b4565b810190611000919061367e565b91509150610f388282611bef565b6003878783818110611022576110226134b1565b90506020020160208101906110379190613593565b601b81111561104857611048613564565b03611094576000806000878785818110611064576110646134b1565b905060200281019061107691906135b4565b81019061108391906136ae565b925092509250610f38838383611d0f565b60048787838181106110a8576110a86134b1565b90506020020160208101906110bd9190613593565b601b8111156110ce576110ce613564565b036110e457478015610f8757610f873382611dd3565b60068787838181106110f8576110f86134b1565b905060200201602081019061110d9190613593565b601b81111561111e5761111e613564565b0361117357600080600087878581811061113a5761113a6134b1565b905060200281019061114c91906135b4565b8101906111599190613773565b92509250925061116a838383611e18565b50505050611727565b6007878783818110611187576111876134b1565b905060200201602081019061119c9190613593565b601b8111156111ad576111ad613564565b036111fb576000808686848181106111c7576111c76134b1565b90506020028101906111d991906135b4565b8101906111e691906137cc565b915091506111f48282611f06565b5050611727565b600987878381811061120f5761120f6134b1565b90506020020160208101906112249190613593565b601b81111561123557611235613564565b036112d85760008060008060008060008b8b89818110611257576112576134b1565b905060200281019061126991906135b4565b810190611276919061396f565b96509650965096509650965096506112908383888a611fc3565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb8684848888866124f0565b5050505050505050611727565b600a8787838181106112ec576112ec6134b1565b90506020020160208101906113019190613593565b601b81111561131257611312613564565b0361137c5760008060008060008060008b8b89818110611334576113346134b1565b905060200281019061134691906135b4565b8101906113539190613a3e565b9650965096509650965096509650611370878787878787876125ba565b50505050505050611727565b600b878783818110611390576113906134b1565b90506020020160208101906113a59190613593565b601b8111156113b6576113b6613564565b036114405760008060008060008989878181106113d5576113d56134b1565b90506020028101906113e791906135b4565b8101906113f49190613aca565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612651565b505050505050611727565b600c878783818110611454576114546134b1565b90506020020160208101906114699190613593565b601b81111561147a5761147a613564565b036114f9576000806000806000898987818110611499576114996134b1565b90506020028101906114ab91906135b4565b8101906114b89190613aca565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b611435848484846126fd565b601b87878381811061150d5761150d6134b1565b90506020020160208101906115229190613593565b601b81111561153357611533613564565b036115b6576000806000806000808a8a88818110611553576115536134b1565b905060200281019061156591906135b4565b8101906115729190612ef9565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134b1565b90506020020160208101906115df9190613593565b601b8111156115f0576115f0613564565b0361164a5760008060008088888681811061160d5761160d6134b1565b905060200281019061161f91906135b4565b81019061162c9190613b25565b9350935093509350611640848484846127a7565b5050505050611727565b600e87878381811061165e5761165e6134b1565b90506020020160208101906116739190613593565b601b81111561168457611684613564565b036116d4576000806000808888868181106116a1576116a16134b1565b90506020028101906116b391906135b4565b8101906116c09190613b25565b93509350935093506116408484848461280f565b6117278787838181106116e9576116e96134b1565b90506020020160208101906116fe9190613593565b868684818110611710576117106134b1565b905060200281019061172291906135b4565b505050565b6117308161350f565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613547565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134b1565b9050602002016020810190611880919061334f565b878784818110611892576118926134b1565b90506020020160208101906118a7919061334f565b8686858181106118b9576118b96134b1565b905060200201356119cd565b6118ce8161350f565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261287a565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a679190613665565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613b6d565b81105b15611ad757611ad283611ab48385613ba8565b73ffffffffffffffffffffffffffffffffffffffff87169190612986565b61051a565b8181111561051a5761051a83611aed8484613ba8565b73ffffffffffffffffffffffffffffffffffffffff87169190612a84565b6000611b19868686866126fd565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b60008073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611bd057600080fd5b505af1158015611be4573d6000803e3d6000fd5b505050505034905090565b6000806040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611c829190613665565b9050611c8e8184612c11565b8015611d09576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101829052600090632e1a7d4d90602401600060405180830381600087803b158015611ce757600080fd5b505af1158015611cfb573d6000803e3d6000fd5b50505050611d098282611dd3565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611d7c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611da09190613665565b9050611dac8184612c11565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c4b565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e5f85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611e879190613bdf565b6000604051808303816000865af19150503d8060008114611ec4576040519150601f19603f3d011682016040523d82523d6000602084013e611ec9565b606091505b509150915081611edc57611edc81612ca1565b80806020019051810190611ef09190613665565b9350611efc8487612c11565b5050509392505050565b805160005b8181101561051a57828181518110611f2557611f256134b1565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611f9a57600080fd5b505af1158015611fae573d6000803e3d6000fd5b5050505080611fbc9061350f565b9050611f0b565b835160609060008167ffffffffffffffff811115611fe357611fe3612fb4565b60405190808252806020026020018201604052801561200c578160200160208202803683370190505b5090506000806000805b858110156124de576000808c8381518110612033576120336134b1565b6020026020010151600781111561204c5761204c613564565b0361205b5760019450506124ce565b60028c838151811061206f5761206f6134b1565b6020026020010151600781111561208857612088613564565b0361219f5760008b83815181106120a1576120a16134b1565b60200260200101518060200190518101906120bc9190613bfb565b909250905060018101612198576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612135573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906121599190613665565b6040805160208101939093528201526060016040516020818303038152906040528c848151811061218c5761218c6134b1565b60200260200101819052505b50506124ce565b60038c83815181106121b3576121b36134b1565b602002602001015160078111156121cc576121cc613564565b1480612202575060058c83815181106121e7576121e76134b1565b6020026020010151600781111561220057612200613564565b145b1561223c578a8281518110612219576122196134b1565b60200260200101518060200190518101906122349190613bfb565b509050612313565b60018c8381518110612250576122506134b1565b6020026020010151600781111561226957612269613564565b036122a2578a8281518110612280576122806134b1565b602002602001015180602001905181019061229b9190613665565b9050612313565b60068c83815181106122b6576122b66134b1565b602002602001015160078111156122cf576122cf613564565b0361230d578a82815181106122e6576122e66134b1565b60200260200101518060200190518101906123019190613c1f565b50919250612313915050565b506124ce565b806000036123a457841561232757506124ce565b836000036123a1578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa15801561237a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061239e9190613665565b93505b50825b60005b838110156123d557818782815181106123c2576123c26134b1565b5050506123ce8161350f565b90506123a7565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612447573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061246b9190613547565b6124a1576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124b4576124b46134b1565b60209081029190910101526124ca600184613c5d565b9250505b6124d78161350f565b9050612016565b5088955050505050505b949350505050565b61251b6040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc69890612577908990899033908a908a908a90600401613d0f565b6080604051808303816000875af1158015612596573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e0f565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061261690899089908990899089908990600401613e75565b600060405180830381600087803b15801561263057600080fd5b505af1158015612644573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301526000916124e8918491908816906394bf804d906044015b6020604051808303816000875af11580156126d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126f59190613665565b925082612c11565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301526000916124e891871690636e553f65906044015b6020604051808303816000875af115801561277a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061279e9190613665565b91508183612c11565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916124e89187169063ba0876529060640161275b565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916124e89184919088169063b460af94906064016126b2565b60006128dc826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612ce29092919063ffffffff16565b80519091501561172257808060200190518101906128fa9190613547565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa1580156129fd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a219190613665565b612a2b9190613c5d565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612afa573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b1e9190613665565b905081811015612bb0576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c0a9086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612cb057805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612cf18484600085612cfb565b90505b9392505050565b606082471015612d8d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e0b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e349190613bdf565b60006040518083038185875af1925050503d8060008114612e71576040519150601f19603f3d011682016040523d82523d6000602084013e612e76565b606091505b50915091506102aa82828660608315612e90575081612cf4565b825115612ea05782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613ece565b73ffffffffffffffffffffffffffffffffffffffff81168114612ef657600080fd5b50565b60008060008060008060c08789031215612f1257600080fd5b8635612f1d81612ed4565b95506020870135612f2d81612ed4565b9450604087013593506060870135612f4481612ed4565b92506080870135915060a0870135612f5b81612ed4565b809150509295509295509295565b600080600060608486031215612f7e57600080fd5b8335612f8981612ed4565b92506020840135612f9981612ed4565b91506040840135612fa981612ed4565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561300657613006612fb4565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561305357613053612fb4565b604052919050565b600067ffffffffffffffff82111561307557613075612fb4565b5060051b60200190565b8015158114612ef657600080fd5b803560ff8116811461309e57600080fd5b919050565b600082601f8301126130b457600080fd5b813560206130c96130c48361305b565b61300c565b82815260e092830285018201928282019190878511156130e857600080fd5b8387015b858110156131705781818a0312156131045760008081fd5b61310c612fe3565b813561311781612ed4565b81528186013561312681612ed4565b818701526040828101359082015260608083013590820152608061314b81840161308d565b9082015260a0828101359082015260c0808301359082015284529284019281016130ec565b5090979650505050505050565b60008083601f84011261318f57600080fd5b50813567ffffffffffffffff8111156131a757600080fd5b6020830191508360208260051b85010111156131c257600080fd5b9250929050565b600080600080600080608087890312156131e257600080fd5b863567ffffffffffffffff808211156131fa57600080fd5b818901915089601f83011261320e57600080fd5b8135602061321e6130c48361305b565b82815260e09092028401810191818101908d84111561323c57600080fd5b948201945b838610156132d35760e0868f03121561325a5760008081fd5b613262612fe3565b863561326d81612ed4565b81528684013561327c81612ed4565b8185015260408781013561328f8161307f565b90820152606087810135908201526132a96080880161308d565b608082015260a0878101359082015260c08088013590820152825260e09095019490820190613241565b9a50508a0135925050808211156132e957600080fd5b6132f58a838b016130a3565b9650604089013591508082111561330b57600080fd5b6133178a838b0161317d565b9096509450606089013591508082111561333057600080fd5b5061333d89828a0161317d565b979a9699509497509295939492505050565b60006020828403121561336157600080fd5b8135612cf481612ed4565b6000806040838503121561337f57600080fd5b823561338a81612ed4565b91506133986020840161308d565b90509250929050565b6000806000806000606086880312156133b957600080fd5b853567ffffffffffffffff808211156133d157600080fd5b6133dd89838a016130a3565b965060208801359150808211156133f357600080fd5b6133ff89838a0161317d565b9096509450604088013591508082111561341857600080fd5b506134258882890161317d565b969995985093965092949392505050565b6000806000806000806060878903121561344f57600080fd5b863567ffffffffffffffff8082111561346757600080fd5b6134738a838b0161317d565b9098509650602089013591508082111561348c57600080fd5b6134988a838b0161317d565b9096509450604089013591508082111561333057600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613540576135406134e0565b5060010190565b60006020828403121561355957600080fd5b8151612cf48161307f565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135a557600080fd5b8135601c8110612cf457600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126135e957600080fd5b83018035915067ffffffffffffffff82111561360457600080fd5b6020019150368190038213156131c257600080fd5b803561309e81612ed4565b60008060006060848603121561363957600080fd5b833561364481612ed4565b9250602084013561365481612ed4565b929592945050506040919091013590565b60006020828403121561367757600080fd5b5051919050565b6000806040838503121561369157600080fd5b8235915060208301356136a381612ed4565b809150509250929050565b6000806000606084860312156136c357600080fd5b83356136ce81612ed4565b9250602084013591506040840135612fa981612ed4565b600082601f8301126136f657600080fd5b813567ffffffffffffffff81111561371057613710612fb4565b61374160207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8401160161300c565b81815284602083860101111561375657600080fd5b816020850160208301376000918101602001919091529392505050565b60008060006060848603121561378857600080fd5b833561379381612ed4565b925060208401359150604084013567ffffffffffffffff8111156137b657600080fd5b6137c2868287016136e5565b9150509250925092565b600080604083850312156137df57600080fd5b82356137ea81612ed4565b915060208381013567ffffffffffffffff81111561380757600080fd5b8401601f8101861361381857600080fd5b80356138266130c48261305b565b81815260059190911b8201830190838101908883111561384557600080fd5b928401925b8284101561386c57833561385d81612ed4565b8252928401929084019061384a565b80955050505050509250929050565b600082601f83011261388c57600080fd5b8135602061389c6130c48361305b565b82815260059290921b840181019181810190868411156138bb57600080fd5b8286015b848110156138e4578035600881106138d75760008081fd5b83529183019183016138bf565b509695505050505050565b600082601f83011261390057600080fd5b813560206139106130c48361305b565b82815260059290921b8401810191818101908684111561392f57600080fd5b8286015b848110156138e457803567ffffffffffffffff8111156139535760008081fd5b6139618986838b01016136e5565b845250918301918301613933565b600080600080600080600060e0888a03121561398a57600080fd5b873561399581612ed4565b965060208801356139a581612ed4565b95506139b360408901613619565b94506139c160608901613619565b9350608088013567ffffffffffffffff808211156139de57600080fd5b6139ea8b838c0161387b565b945060a08a0135915080821115613a0057600080fd5b613a0c8b838c016138ef565b935060c08a0135915080821115613a2257600080fd5b50613a2f8a828b016136e5565b91505092959891949750929550565b600080600080600080600060e0888a031215613a5957600080fd5b8735613a6481612ed4565b96506020880135613a7481612ed4565b95506040880135613a8481612ed4565b94506060880135613a9481612ed4565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613abe57600080fd5b613a2f8a828b016136e5565b600080600080600060a08688031215613ae257600080fd5b8535613aed81612ed4565b94506020860135613afd81612ed4565b9350604086013592506060860135613b1481612ed4565b949793965091946080013592915050565b60008060008060808587031215613b3b57600080fd5b8435613b4681612ed4565b9350602085013592506040850135613b5d81612ed4565b9396929550929360600135925050565b600082613ba3577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d0957611d096134e0565b60005b83811015613bd6578181015183820152602001613bbe565b50506000910152565b60008251613bf1818460208701613bbb565b9190910192915050565b60008060408385031215613c0e57600080fd5b505080516020909101519092909150565b60008060008060808587031215613c3557600080fd5b845193506020850151613c4781612ed4565b6040860151606090960151949790965092505050565b80820180821115611d0957611d096134e0565b60008151808452613c88816020860160208601613bbb565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d02578284038952613cf0848351613c70565b98850198935090840190600101613cd8565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613d7e57825160088110613d6c577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d2d565b5050505083810382850152613d93818a613cba565b915050613db8604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e028185613c70565b9998505050505050505050565b600060808284031215613e2157600080fd5b6040516080810181811067ffffffffffffffff82111715613e4457613e44612fb4565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613ec260c0830184613c70565b98975050505050505050565b602081526000612cf46020830184613c7056fea26469706673582212205658029a519003a8ee0f66e313233baa1bbca7b8eabd724e22422f76699d475364736f6c63430008110033", + "devdoc": { + "author": "Angle Core Team", + "kind": "dev", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "params": { + "amounts": "Amounts to allow", + "spenders": "Addresses to allow transfer", + "tokens": "Addresses of the tokens to allow" + } + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens", + "params": { + "actions": "List of actions to be performed by the router (in order of execution)", + "data": "Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored", + "paramsPermit": "Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it" + } + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option", + "params": { + "paramsPermitVaultManager": "Parameters to sign permit to give allowance to the router for a `VaultManager` contract" + } + } + }, + "title": "AngleRouterCelo", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "notice": "Changes allowances for different tokens" + }, + "core()": { + "notice": "Core address handling access control" + }, + "deposit4626Referral(address,address,uint256,address,uint256,address)": { + "notice": "Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract" + }, + "initializeRouter(address,address,address)": { + "notice": "Deploys the router contract on a chain" + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Allows composable calls to different functions within the protocol" + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions" + }, + "oneInch()": { + "notice": "Address of 1Inch router used for swaps" + }, + "setCore(address)": { + "notice": "Sets a new `core` contract" + }, + "setRouter(address,uint8)": { + "notice": "Sets a new router variable" + }, + "uniswapV3Router()": { + "notice": "Address of the router used for swaps" + } + }, + "notice": "Router contract built specifially for Angle use cases on Celo", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6, + "contract": "contracts/implementations/celo/AngleRouterCelo.sol:AngleRouterCelo", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 9, + "contract": "contracts/implementations/celo/AngleRouterCelo.sol:AngleRouterCelo", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 1478, + "contract": "contracts/implementations/celo/AngleRouterCelo.sol:AngleRouterCelo", + "label": "core", + "offset": 2, + "slot": "0", + "type": "t_contract(ICoreBorrow)3793" + }, + { + "astId": 1482, + "contract": "contracts/implementations/celo/AngleRouterCelo.sol:AngleRouterCelo", + "label": "uniswapV3Router", + "offset": 0, + "slot": "1", + "type": "t_contract(IUniswapV3Router)4262" + }, + { + "astId": 1485, + "contract": "contracts/implementations/celo/AngleRouterCelo.sol:AngleRouterCelo", + "label": "oneInch", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 1489, + "contract": "contracts/implementations/celo/AngleRouterCelo.sol:AngleRouterCelo", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint256)47_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ICoreBorrow)3793": { + "encoding": "inplace", + "label": "contract ICoreBorrow", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Router)4262": { + "encoding": "inplace", + "label": "contract IUniswapV3Router", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/celo/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json b/deployments/celo/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json new file mode 100644 index 0000000..c75418b --- /dev/null +++ b/deployments/celo/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json @@ -0,0 +1,142 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\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 IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\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 require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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 */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\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. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/BaseRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport \"./interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./interfaces/external/IWETH9.sol\";\nimport \"./interfaces/ICoreBorrow.sol\";\nimport \"./interfaces/IDepositWithReferral.sol\";\nimport \"./interfaces/ILiquidityGauge.sol\";\nimport \"./interfaces/ISwapper.sol\";\nimport \"./interfaces/IVaultManager.sol\";\n\n// ============================== STRUCTS AND ENUM =============================\n\n/// @notice Action types\nenum ActionType {\n transfer,\n wrapNative,\n unwrapNative,\n sweep,\n sweepNative,\n // Deprecated\n uniswapV3,\n oneInch,\n claimRewards,\n // Deprecated\n gaugeDeposit,\n borrower,\n swapper,\n mint4626,\n deposit4626,\n redeem4626,\n withdraw4626,\n // Deprecated\n prepareRedeemSavingsRate,\n // Deprecated\n claimRedeemSavingsRate,\n // Deprecated\n swapIn,\n // Deprecated\n swapOut,\n claimWeeklyInterest,\n // Deprecated\n withdraw,\n // Deprecated\n mint,\n // Deprecated\n deposit,\n // Deprecated\n openPerpetual,\n // Deprecated\n addToPerpetual,\n veANGLEDeposit,\n // Deprecated\n claimRewardsWithPerps,\n deposit4626Referral\n}\n\n/// @notice Data needed to get permits\nstruct PermitType {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @notice Data to grant permit to the router for a vault\nstruct PermitVaultManagerType {\n address vaultManager;\n address owner;\n bool approved;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @title BaseRouter\n/// @author Angle Core Team\n/// @notice Base contract that Angle router contracts on different chains should override\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\n using SafeERC20 for IERC20;\n\n // ================================= REFERENCES ================================\n\n /// @notice Core address handling access control\n ICoreBorrow public core;\n /// @notice Address of the router used for swaps\n IUniswapV3Router public uniswapV3Router;\n /// @notice Address of 1Inch router used for swaps\n address public oneInch;\n\n uint256[47] private __gap;\n\n // ============================== EVENTS / ERRORS ==============================\n\n error IncompatibleLengths();\n error InvalidReturnMessage();\n error NotApprovedOrOwner();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error TooSmallAmountOut();\n error TransferFailed();\n error ZeroAddress();\n\n event ReferredDeposit(\n address caller,\n address indexed owner,\n uint256 assets,\n uint256 shares,\n address indexed savings,\n address indexed referrer\n );\n\n /// @notice Deploys the router contract on a chain\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\n if (_core == address(0)) revert ZeroAddress();\n core = ICoreBorrow(_core);\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\n oneInch = _oneInch;\n }\n\n constructor() initializer {}\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @notice Allows composable calls to different functions within the protocol\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\n /// @param actions List of actions to be performed by the router (in order of execution)\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\n /// for a given action are stored\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\n /// do not perform a sweep action on these tokens\n function mixer(\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) public payable virtual {\n // If all tokens have already been approved, there's no need for this step\n uint256 permitsLength = paramsPermit.length;\n for (uint256 i; i < permitsLength; ++i) {\n IERC20Permit(paramsPermit[i].token).permit(\n paramsPermit[i].owner,\n address(this),\n paramsPermit[i].value,\n paramsPermit[i].deadline,\n paramsPermit[i].v,\n paramsPermit[i].r,\n paramsPermit[i].s\n );\n }\n // Performing actions one after the others\n uint256 actionsLength = actions.length;\n for (uint256 i; i < actionsLength; ++i) {\n if (actions[i] == ActionType.transfer) {\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\n } else if (actions[i] == ActionType.wrapNative) {\n _wrapNative();\n } else if (actions[i] == ActionType.unwrapNative) {\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\n _unwrapNative(minAmountOut, to);\n } else if (actions[i] == ActionType.sweep) {\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\n _sweep(tokenOut, minAmountOut, to);\n } else if (actions[i] == ActionType.sweepNative) {\n uint256 routerBalance = address(this).balance;\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\n } else if (actions[i] == ActionType.oneInch) {\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\n data[i],\n (address, uint256, bytes)\n );\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\n } else if (actions[i] == ActionType.claimRewards) {\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\n _claimRewards(user, claimLiquidityGauges);\n } else if (actions[i] == ActionType.borrower) {\n (\n address collateral,\n address vaultManager,\n address to,\n address who,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n bytes memory repayData\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\n } else if (actions[i] == ActionType.swapper) {\n (\n ISwapper swapperContract,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory payload\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\n } else if (actions[i] == ActionType.mint4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _mint4626(savingsRate, shares, to, maxAmountIn);\n } else if (actions[i] == ActionType.deposit4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626(savingsRate, amount, to, minSharesOut);\n } else if (actions[i] == ActionType.deposit4626Referral) {\n (\n IERC20 token,\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\n } else if (actions[i] == ActionType.redeem4626) {\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _redeem4626(savingsRate, shares, to, minAmountOut);\n } else if (actions[i] == ActionType.withdraw4626) {\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\n } else {\n _chainSpecificAction(actions[i], data[i]);\n }\n }\n }\n\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\n /// addresses depositing from a certain referring address into an ERC4626 contract\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n _changeAllowance(IERC20(token), savings, type(uint256).max);\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\n }\n\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\n /// actions and then revoking this approval after these actions\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\n /// to revoke approvals\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\n /// is just an option\n function mixerVaultManagerPermit(\n PermitVaultManagerType[] memory paramsPermitVaultManager,\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) external payable virtual {\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n true,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n } else break;\n }\n mixer(paramsPermit, actions, data);\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\n // too deep\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (!paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n false,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n }\n }\n }\n\n receive() external payable {}\n\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\n\n /// @notice Wraps the native token of a chain to its wrapped version\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\n /// @dev The amount to wrap is to be specified in the `msg.value`\n function _wrapNative() internal virtual returns (uint256) {\n _getNativeWrapper().deposit{ value: msg.value }();\n return msg.value;\n }\n\n /// @notice Unwraps the wrapped version of a token to the native chain token\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\n amount = _getNativeWrapper().balanceOf(address(this));\n _slippageCheck(amount, minAmountOut);\n if (amount != 0) {\n _getNativeWrapper().withdraw(amount);\n _safeTransferNative(to, amount);\n }\n return amount;\n }\n\n /// @notice Internal version of the `claimRewards` function\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\n uint256 gaugesLength = liquidityGauges.length;\n for (uint256 i; i < gaugesLength; ++i) {\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\n }\n }\n\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\n /// @param vaultManager Address of the vault to perform actions on\n /// @param actionsBorrow Actions type to perform on the vaultManager\n /// @param dataBorrow Data needed for each actions\n /// @param to Address to send the funds to\n /// @param who Swapper address to handle repayments\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\n function _angleBorrower(\n address vaultManager,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address to,\n address who,\n bytes memory repayData\n ) internal virtual returns (PaymentData memory paymentData) {\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\n }\n\n /// @notice Sweeps tokens from the router contract\n /// @param tokenOut Token to sweep\n /// @param minAmountOut Minimum amount of tokens to recover\n /// @param to Address to which tokens should be sent\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\n _slippageCheck(balanceToken, minAmountOut);\n if (balanceToken != 0) {\n IERC20(tokenOut).safeTransfer(to, balanceToken);\n }\n }\n\n /// @notice Uses an external swapper\n /// @param swapper Contracts implementing the logic of the swap\n /// @param inToken Token used to do the swap\n /// @param outToken Token wanted\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\n /// @param inTokenObtained Amount of `inToken` used for the swap\n /// @param data Additional info for the specific swapper\n function _swapper(\n ISwapper swapper,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) internal {\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\n }\n\n /// @notice Swaps an inToken to another token via 1Inch Router\n /// @param payload Bytes needed for 1Inch router to process the swap\n /// @dev The `payload` given is expected to be obtained from 1Inch API\n function _swapOn1Inch(\n IERC20 inToken,\n uint256 minAmountOut,\n bytes memory payload\n ) internal returns (uint256 amountOut) {\n // Approve transfer to the `oneInch` address\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\n address oneInchRouter = oneInch;\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\n //solhint-disable-next-line\n (bool success, bytes memory result) = oneInchRouter.call(payload);\n if (!success) _revertBytes(result);\n\n amountOut = abi.decode(result, (uint256));\n _slippageCheck(amountOut, minAmountOut);\n }\n\n /// @notice Mints `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to mint shares from\n /// @param shares Amount of shares to mint from the contract\n /// @param to Address to which shares should be sent\n /// @param maxAmountIn Max amount of assets used to mint\n /// @return amountIn Amount of assets used to mint by `to`\n function _mint4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 maxAmountIn\n ) internal returns (uint256 amountIn) {\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\n }\n\n /// @notice Deposits `amount` to an ERC4626 contract\n /// @param savingsRate The ERC4626 to deposit assets to\n /// @param amount Amount of assets to deposit\n /// @param to Address to which shares should be sent\n /// @param minSharesOut Minimum amount of shares that `to` should received\n /// @return sharesOut Amount of shares received by `to`\n function _deposit4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\n }\n\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\n function _deposit4626Referral(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) internal returns (uint256 sharesOut) {\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\n }\n\n /// @notice Withdraws `amount` from an ERC4626 contract\n /// @param savingsRate ERC4626 to withdraw assets from\n /// @param amount Amount of assets to withdraw\n /// @param to Destination of assets\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\n /// @return sharesOut Amount of shares burnt\n function _withdraw4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 maxSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\n }\n\n /// @notice Redeems `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to redeem shares from\n /// @param shares Amount of shares to redeem\n /// @param to Destination of assets\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\n /// @return amountOut Amount of assets received by `to`\n function _redeem4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 minAmountOut\n ) internal returns (uint256 amountOut) {\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\n }\n\n /// @notice Allows to perform some specific actions for a chain\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\n\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\n\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\n\n // ============================ GOVERNANCE FUNCTION ============================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Sets a new `core` contract\n function setCore(ICoreBorrow _core) external {\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\n core = ICoreBorrow(_core);\n }\n\n /// @notice Changes allowances for different tokens\n /// @param tokens Addresses of the tokens to allow\n /// @param spenders Addresses to allow transfer\n /// @param amounts Amounts to allow\n function changeAllowance(\n IERC20[] calldata tokens,\n address[] calldata spenders,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\n for (uint256 i; i < tokensLength; ++i) {\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\n }\n }\n\n /// @notice Sets a new router variable\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\n if (router == address(0)) revert ZeroAddress();\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\n else oneInch = router;\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Changes allowance of this contract for a given token\n /// @param token Address of the token to change allowance\n /// @param spender Address to change the allowance of\n /// @param amount Amount allowed\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\n uint256 currentAllowance = token.allowance(address(this), spender);\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\n } else if (currentAllowance > amount) {\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\n }\n }\n\n /// @notice Transfer amount of the native token to the `to` address\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\n function _safeTransferNative(address to, uint256 amount) internal {\n bool success;\n //solhint-disable-next-line\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) revert TransferFailed();\n }\n\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\n /// the calling address is well approved for all the vaults with which it is interacting\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\n /// with a vault are approved for this vault\n function _parseVaultIDs(\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address vaultManager,\n address collateral\n ) internal view returns (bytes[] memory) {\n uint256 actionsBorrowLength = actionsBorrow.length;\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\n bool createVaultAction;\n uint256 lastVaultID;\n uint256 vaultIDLength;\n for (uint256 i; i < actionsBorrowLength; ++i) {\n uint256 vaultID;\n // If there is a `createVault` action, the router should not worry about looking at\n // next vaultIDs given equal to 0\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\n createVaultAction = true;\n continue;\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\n // as collateral the full contract balance\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\n uint256 amount;\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\n if (amount == type(uint256).max)\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\n continue;\n // There are different ways depending on the action to find the `vaultID` to parse\n } else if (\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\n ) {\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\n vaultID = abi.decode(dataBorrow[i], (uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\n } else continue;\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\n // if there has not been any specific action\n if (vaultID == 0) {\n if (createVaultAction) {\n continue;\n } else {\n // If we haven't stored the last `vaultID`, we need to fetch it\n if (lastVaultID == 0) {\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\n }\n vaultID = lastVaultID;\n }\n }\n\n // Check if this `vaultID` has already been verified\n for (uint256 j; j < vaultIDLength; ++j) {\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\n // If yes, we continue to the next iteration\n continue;\n }\n }\n // Verify this new `vaultID` and add it to the list\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\n revert NotApprovedOrOwner();\n }\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\n vaultIDLength += 1;\n }\n return dataBorrow;\n }\n\n /// @notice Checks whether the amount obtained during a swap is not too small\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\n if (amount < thresholdAmount) revert TooSmallAmountOut();\n }\n\n /// @notice Internal function used for error handling\n function _revertBytes(bytes memory errMsg) internal pure {\n if (errMsg.length != 0) {\n //solhint-disable-next-line\n assembly {\n revert(add(32, errMsg), mload(errMsg))\n }\n }\n revert InvalidReturnMessage();\n }\n}\n" + }, + "contracts/implementations/arbitrum/AngleRouterArbitrum.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterArbitrum\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\ncontract AngleRouterArbitrum is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n }\n}\n" + }, + "contracts/implementations/avalanche/AngleRouterAvalanche.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterAvalanche\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Avalanche\ncontract AngleRouterAvalanche is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n }\n}\n" + }, + "contracts/implementations/base/AngleRouterBase.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterBase\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Base\ncontract AngleRouterBase is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/celo/AngleRouterCelo.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterCelo\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Celo\ncontract AngleRouterCelo is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0000000000000000000000000000000000000000);\n }\n}\n" + }, + "contracts/implementations/gnosis/AngleRouterGnosis.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterGnosis\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Gnosis\ncontract AngleRouterGnosis is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n }\n}\n" + }, + "contracts/implementations/mainnet/AngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../interfaces/IFeeDistributorFront.sol\";\nimport \"../../interfaces/ISanToken.sol\";\nimport \"../../interfaces/IStableMasterFront.sol\";\nimport \"../../interfaces/IVeANGLE.sol\";\n\nimport \"../../BaseRouter.sol\";\n\n// ============================= STRUCTS AND ENUMS =============================\n\n/// @notice References to the contracts associated to a collateral for a stablecoin\nstruct Pairs {\n IPoolManager poolManager;\n IPerpetualManagerFrontWithClaim perpetualManager;\n ISanToken sanToken;\n ILiquidityGauge gauge;\n}\n\n/// @title AngleRouterMainnet\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Ethereum\n/// @dev Previous implementation with an initialization function can be found here:\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\ncontract AngleRouterMainnet is BaseRouter {\n using SafeERC20 for IERC20;\n\n // =================================== ERRORS ==================================\n\n error InvalidParams();\n\n // ================================== MAPPINGS =================================\n\n /// @notice Maps an agToken to its counterpart `StableMaster`\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\n\n uint256[48] private __gapMainnet;\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @inheritdoc BaseRouter\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\n if (action == ActionType.claimWeeklyInterest) {\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\n } else if (action == ActionType.veANGLEDeposit) {\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\n _depositOnLocker(user, amount);\n }\n }\n\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n }\n\n /// @notice Deposits ANGLE on an existing locker\n /// @param user Address to deposit for\n /// @param amount Amount to deposit\n function _depositOnLocker(address user, uint256 amount) internal {\n _getVeANGLE().deposit_for(user, amount);\n }\n\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\n /// @param user Address to claim for\n /// @param _feeDistributor Address of the fee distributor to claim to\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\n /// transfer the token claimed from the `feeDistributor`\n function _claimWeeklyInterest(\n address user,\n IFeeDistributorFront _feeDistributor,\n bool letInContract\n ) internal {\n uint256 amount = _feeDistributor.claim(user);\n if (letInContract) {\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\n IERC20 token = IERC20(_feeDistributor.token());\n token.safeTransferFrom(msg.sender, address(this), amount);\n }\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Returns the veANGLE address\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\n }\n}\n" + }, + "contracts/implementations/optimism/AngleRouterOptimism.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterOptimism\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Optimism\ncontract AngleRouterOptimism is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/polygon/AngleRouterPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterPolygon\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Polygon\ncontract AngleRouterPolygon is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n }\n}\n" + }, + "contracts/interfaces/external/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nstruct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n}\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IUniswapV3Router {\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n\n/// @title Router for price estimation functionality\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\n/// @dev This interface is only used for non critical elements of the protocol\ninterface IUniswapV2Router {\n /// @notice Given an input asset amount, returns the maximum output amount of the\n /// other asset (accounting for fees) given reserves.\n /// @param path Addresses of the pools used to get prices\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokens(\n uint256 swapAmount,\n uint256 minExpected,\n address[] calldata path,\n address receiver,\n uint256 swapDeadline\n ) external;\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICoreBorrow\n/// @author Angle Core Team\n/// @notice Interface for the `CoreBorrow` contract\n\ninterface ICoreBorrow {\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IDepositWithReferral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title IDepositWithReferral\n/// @author Angle Core Team\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\ninterface IDepositWithReferral {\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\n /// obtained, the function reverts\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\n /// when a deposit takes place\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut);\n}\n" + }, + "contracts/interfaces/IFeeDistributorFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IFeeDistributorFront\n/// @author Interface for public use of the `FeeDistributor` contract\n/// @dev This interface is used for user related function\ninterface IFeeDistributorFront {\n function token() external returns (address);\n\n function claim(address _addr) external returns (uint256);\n\n function claim(address[20] memory _addr) external returns (bool);\n}\n" + }, + "contracts/interfaces/ILiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function staking_token() external returns (address stakingToken);\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external;\n}\n" + }, + "contracts/interfaces/IPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title Interface of the contract managing perpetuals with claim function\n/// @author Angle Core Team\n/// @dev Front interface with rewards function, meaning only user-facing functions\ninterface IPerpetualManagerFrontWithClaim {\n function getReward(uint256 perpetualID) external;\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\n\n function openPerpetual(\n address owner,\n uint256 amountBrought,\n uint256 amountCommitted,\n uint256 maxOracleRate,\n uint256 minNetMargin\n ) external returns (uint256 perpetualID);\n}\n" + }, + "contracts/interfaces/IPoolManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IPoolManager {\n function token() external view returns (address);\n}\n" + }, + "contracts/interfaces/ISanToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ISanToken is IERC20Upgradeable {}\n" + }, + "contracts/interfaces/IStableMasterFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IPoolManager.sol\";\nimport \"./ISanToken.sol\";\nimport \"./IPerpetualManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Struct to handle all the parameters to manage the fees\n// related to a given collateral pool (associated to the stablecoin)\nstruct MintBurnData {\n // Values of the thresholds to compute the minting fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeMint;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeMint;\n // Values of the thresholds to compute the burning fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeBurn;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeBurn;\n // Max proportion of collateral from users that can be covered by HAs\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\n // the other changes accordingly\n uint64 targetHAHedge;\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusMint;\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusBurn;\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\n uint256 capOnStableMinted;\n}\n\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\n// including the fraction of interests they receive or the fees to be distributed to\n// them\nstruct SLPData {\n // Last timestamp at which the `sanRate` has been updated for SLPs\n uint256 lastBlockUpdated;\n // Fees accumulated from previous blocks and to be distributed to SLPs\n uint256 lockedInterests;\n // Max interests used to update the `sanRate` in a single block\n // Should be in collateral token base\n uint256 maxInterestsDistributed;\n // Amount of fees left aside for SLPs and that will be distributed\n // when the protocol is collateralized back again\n uint256 feesAside;\n // Part of the fees normally going to SLPs that is left aside\n // before the protocol is collateralized back again (depends on collateral ratio)\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippageFee;\n // Portion of the fees from users minting and burning\n // that goes to SLPs (the rest goes to surplus)\n uint64 feesForSLPs;\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippage;\n // Portion of the interests from lending\n // that goes to SLPs (the rest goes to surplus)\n uint64 interestsForSLPs;\n}\n\n/// @title IStableMasterFront\n/// @author Angle Core Team\n/// @dev Front interface, meaning only user-facing functions\ninterface IStableMasterFront {\n function collateralMap(IPoolManager poolManager)\n external\n view\n returns (\n IERC20 token,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n address oracle,\n uint256 stocksUsers,\n uint256 sanRate,\n uint256 collatBase,\n SLPData memory slpData,\n MintBurnData memory feeData\n );\n\n function updateStocksUsers(uint256 amount, address poolManager) external;\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256 minStableAmount\n ) external;\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256 minCollatAmount\n ) external;\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external;\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external;\n\n function agToken() external returns (address);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Core Team\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\ninterface ISwapper {\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager``\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\n uint256 normalizedDebt;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionBorrowType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IVeANGLE\n/// @author Angle Core Team\n/// @notice Interface for the `VeANGLE` contract\ninterface IVeANGLE {\n // solhint-disable-next-line func-name-mixedcase\n function deposit_for(address addr, uint256 amount) external;\n}\n" + }, + "contracts/mock/MockAngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../implementations/mainnet/AngleRouterMainnet.sol\";\n\ncontract MockAngleRouterMainnet is AngleRouterMainnet {\n address public veAngle;\n\n function setAngleAndVeANGLE(address _veAngle) external {\n veAngle = _veAngle;\n }\n\n function _getVeANGLE() internal view override returns (IVeANGLE) {\n return IVeANGLE(veAngle);\n }\n\n function addStableMaster(IERC20 stablecoin, IStableMasterFront stableMaster) external {\n mapStableMasters[stablecoin] = stableMaster;\n }\n\n function addPairs(\n IERC20[] calldata stablecoins,\n IPoolManager[] calldata poolManagers,\n ILiquidityGauge[] calldata liquidityGauges,\n bool[] calldata justLiquidityGauges\n ) external {\n for (uint256 i; i < stablecoins.length; ++i) {\n IStableMasterFront stableMaster = mapStableMasters[stablecoins[i]];\n _addPair(stableMaster, poolManagers[i], liquidityGauges[i], justLiquidityGauges[i]);\n }\n }\n\n function _addPair(\n IStableMasterFront stableMaster,\n IPoolManager poolManager,\n ILiquidityGauge liquidityGauge,\n bool justLiquidityGauge\n ) internal {\n // Fetching the associated `sanToken` and `perpetualManager` from the contract\n (\n IERC20 collateral,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n ,\n ,\n ,\n ,\n ,\n\n ) = stableMaster.collateralMap(poolManager);\n // Reverting if the poolManager is not a valid `poolManager`\n if (address(collateral) == address(0)) revert InvalidParams();\n Pairs storage _pairs = mapPoolManagers[stableMaster][collateral];\n if (justLiquidityGauge) {\n // Cannot specify a liquidity gauge if the associated poolManager does not exist\n if (address(_pairs.poolManager) == address(0)) revert ZeroAddress();\n ILiquidityGauge gauge = _pairs.gauge;\n if (address(gauge) != address(0)) {\n _changeAllowance(IERC20(address(sanToken)), address(gauge), 0);\n }\n } else {\n // Checking if the pair has not already been initialized: if yes we need to make the function revert\n // otherwise we could end up with still approved `PoolManager` and `PerpetualManager` contracts\n if (address(_pairs.poolManager) != address(0)) revert InvalidParams();\n _pairs.poolManager = poolManager;\n _pairs.perpetualManager = IPerpetualManagerFrontWithClaim(address(perpetualManager));\n _pairs.sanToken = sanToken;\n _changeAllowance(collateral, address(stableMaster), type(uint256).max);\n _changeAllowance(collateral, address(perpetualManager), type(uint256).max);\n }\n _pairs.gauge = liquidityGauge;\n if (address(liquidityGauge) != address(0)) {\n if (address(sanToken) != liquidityGauge.staking_token()) revert InvalidParams();\n _changeAllowance(IERC20(address(sanToken)), address(liquidityGauge), type(uint256).max);\n }\n }\n}\n\ncontract MockAngleRouterMainnet2 is AngleRouterMainnet {\n function getVeANGLE() external view returns (IVeANGLE) {\n return _getVeANGLE();\n }\n}\n" + }, + "contracts/mock/MockRouterSidechain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/external/IWETH9.sol\";\n\nimport \"../BaseRouter.sol\";\n\n/// @title MockRouterSidechain\n/// @author Angle Core Team\n/// @notice Mock contract but built for tests as if to be deployed on Ethereum\ncontract MockRouterSidechain is BaseRouter {\n IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function _wrapNative() internal pure override returns (uint256) {\n return 0;\n }\n\n function _unwrapNative(uint256, address) internal pure override returns (uint256 amount) {\n return 0;\n }\n\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return WETH;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/gnosis/AngleRouterGnosisV3_0_Implementation.json b/deployments/gnosis/AngleRouterGnosisV3_0_Implementation.json new file mode 100644 index 0000000..0ed4de9 --- /dev/null +++ b/deployments/gnosis/AngleRouterGnosisV3_0_Implementation.json @@ -0,0 +1,618 @@ +{ + "address": "0x20adEcB8e89947DF5C2FDcB68416a1a73f54Bd60", + "abi": [ + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReturnMessage", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferredDeposit", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "spenders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "changeAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit4626Referral", + "outputs": [ + { + "internalType": "uint256", + "name": "sharesOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_uniswapRouter", + "type": "address" + }, + { + "internalType": "address", + "name": "_oneInch", + "type": "address" + } + ], + "name": "initializeRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vaultManager", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitVaultManagerType[]", + "name": "paramsPermitVaultManager", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixerVaultManagerPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "oneInch", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "_core", + "type": "address" + } + ], + "name": "setCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "internalType": "uint8", + "name": "who", + "type": "uint8" + } + ], + "name": "setRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "uniswapV3Router", + "outputs": [ + { + "internalType": "contract IUniswapV3Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x1bf2c85712a794be0c5ee410cee135c2c54673cbb2d9ba227bfdd996ef804787", + "receipt": { + "to": null, + "from": "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701", + "contractAddress": "0x20adEcB8e89947DF5C2FDcB68416a1a73f54Bd60", + "transactionIndex": 1, + "gasUsed": "3564890", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000400000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x95d58477a4776561ae7686ffe7f64fb600c5f577c09c7cf2ec925eab751c7647", + "transactionHash": "0x1bf2c85712a794be0c5ee410cee135c2c54673cbb2d9ba227bfdd996ef804787", + "logs": [ + { + "transactionIndex": 1, + "blockNumber": 33921030, + "transactionHash": "0x1bf2c85712a794be0c5ee410cee135c2c54673cbb2d9ba227bfdd996ef804787", + "address": "0x20adEcB8e89947DF5C2FDcB68416a1a73f54Bd60", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 2196, + "blockHash": "0x95d58477a4776561ae7686ffe7f64fb600c5f577c09c7cf2ec925eab751c7647" + } + ], + "blockNumber": 33921030, + "cumulativeGasUsed": "13886193", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0d1b1c94fd2e1964436c8b9a0e25c545", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReturnMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApprovedOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferredDeposit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"spenders\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"changeAllowance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minSharesOut\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"deposit4626Referral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sharesOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_uniswapRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oneInch\",\"type\":\"address\"}],\"name\":\"initializeRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"vaultManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitVaultManagerType[]\",\"name\":\"paramsPermitVaultManager\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixerVaultManagerPermit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oneInch\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"setCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"who\",\"type\":\"uint8\"}],\"name\":\"setRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV3Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Router\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"params\":{\"amounts\":\"Amounts to allow\",\"spenders\":\"Addresses to allow transfer\",\"tokens\":\"Addresses of the tokens to allow\"}},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens\",\"params\":{\"actions\":\"List of actions to be performed by the router (in order of execution)\",\"data\":\"Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored\",\"paramsPermit\":\"Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\"}},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option\",\"params\":{\"paramsPermitVaultManager\":\"Parameters to sign permit to give allowance to the router for a `VaultManager` contract\"}}},\"title\":\"AngleRouterGnosis\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"notice\":\"Changes allowances for different tokens\"},\"core()\":{\"notice\":\"Core address handling access control\"},\"deposit4626Referral(address,address,uint256,address,uint256,address)\":{\"notice\":\"Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract\"},\"initializeRouter(address,address,address)\":{\"notice\":\"Deploys the router contract on a chain\"},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Allows composable calls to different functions within the protocol\"},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions\"},\"oneInch()\":{\"notice\":\"Address of 1Inch router used for swaps\"},\"setCore(address)\":{\"notice\":\"Sets a new `core` contract\"},\"setRouter(address,uint8)\":{\"notice\":\"Sets a new router variable\"},\"uniswapV3Router()\":{\"notice\":\"Address of the router used for swaps\"}},\"notice\":\"Router contract built specifially for Angle use cases on Gnosis\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/implementations/gnosis/AngleRouterGnosis.sol\":\"AngleRouterGnosis\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x9750c6fec736eb3320e85924f36a3060fa4a4ab1758d06d9585e175d164eefdb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\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 IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\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 require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\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 */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\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. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"contracts/BaseRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport \\\"./interfaces/external/uniswap/IUniswapRouter.sol\\\";\\nimport \\\"./interfaces/external/IWETH9.sol\\\";\\nimport \\\"./interfaces/ICoreBorrow.sol\\\";\\nimport \\\"./interfaces/IDepositWithReferral.sol\\\";\\nimport \\\"./interfaces/ILiquidityGauge.sol\\\";\\nimport \\\"./interfaces/ISwapper.sol\\\";\\nimport \\\"./interfaces/IVaultManager.sol\\\";\\n\\n// ============================== STRUCTS AND ENUM =============================\\n\\n/// @notice Action types\\nenum ActionType {\\n transfer,\\n wrapNative,\\n unwrapNative,\\n sweep,\\n sweepNative,\\n // Deprecated\\n uniswapV3,\\n oneInch,\\n claimRewards,\\n // Deprecated\\n gaugeDeposit,\\n borrower,\\n swapper,\\n mint4626,\\n deposit4626,\\n redeem4626,\\n withdraw4626,\\n // Deprecated\\n prepareRedeemSavingsRate,\\n // Deprecated\\n claimRedeemSavingsRate,\\n // Deprecated\\n swapIn,\\n // Deprecated\\n swapOut,\\n claimWeeklyInterest,\\n // Deprecated\\n withdraw,\\n // Deprecated\\n mint,\\n // Deprecated\\n deposit,\\n // Deprecated\\n openPerpetual,\\n // Deprecated\\n addToPerpetual,\\n veANGLEDeposit,\\n // Deprecated\\n claimRewardsWithPerps,\\n deposit4626Referral\\n}\\n\\n/// @notice Data needed to get permits\\nstruct PermitType {\\n address token;\\n address owner;\\n uint256 value;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @notice Data to grant permit to the router for a vault\\nstruct PermitVaultManagerType {\\n address vaultManager;\\n address owner;\\n bool approved;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @title BaseRouter\\n/// @author Angle Core Team\\n/// @notice Base contract that Angle router contracts on different chains should override\\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\\n using SafeERC20 for IERC20;\\n\\n // ================================= REFERENCES ================================\\n\\n /// @notice Core address handling access control\\n ICoreBorrow public core;\\n /// @notice Address of the router used for swaps\\n IUniswapV3Router public uniswapV3Router;\\n /// @notice Address of 1Inch router used for swaps\\n address public oneInch;\\n\\n uint256[47] private __gap;\\n\\n // ============================== EVENTS / ERRORS ==============================\\n\\n error IncompatibleLengths();\\n error InvalidReturnMessage();\\n error NotApprovedOrOwner();\\n error NotGovernor();\\n error NotGovernorOrGuardian();\\n error TooSmallAmountOut();\\n error TransferFailed();\\n error ZeroAddress();\\n\\n event ReferredDeposit(\\n address caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares,\\n address indexed savings,\\n address indexed referrer\\n );\\n\\n /// @notice Deploys the router contract on a chain\\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\\n if (_core == address(0)) revert ZeroAddress();\\n core = ICoreBorrow(_core);\\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\\n oneInch = _oneInch;\\n }\\n\\n constructor() initializer {}\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @notice Allows composable calls to different functions within the protocol\\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\\n /// @param actions List of actions to be performed by the router (in order of execution)\\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\\n /// for a given action are stored\\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\\n /// do not perform a sweep action on these tokens\\n function mixer(\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) public payable virtual {\\n // If all tokens have already been approved, there's no need for this step\\n uint256 permitsLength = paramsPermit.length;\\n for (uint256 i; i < permitsLength; ++i) {\\n IERC20Permit(paramsPermit[i].token).permit(\\n paramsPermit[i].owner,\\n address(this),\\n paramsPermit[i].value,\\n paramsPermit[i].deadline,\\n paramsPermit[i].v,\\n paramsPermit[i].r,\\n paramsPermit[i].s\\n );\\n }\\n // Performing actions one after the others\\n uint256 actionsLength = actions.length;\\n for (uint256 i; i < actionsLength; ++i) {\\n if (actions[i] == ActionType.transfer) {\\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\\n } else if (actions[i] == ActionType.wrapNative) {\\n _wrapNative();\\n } else if (actions[i] == ActionType.unwrapNative) {\\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\\n _unwrapNative(minAmountOut, to);\\n } else if (actions[i] == ActionType.sweep) {\\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\\n _sweep(tokenOut, minAmountOut, to);\\n } else if (actions[i] == ActionType.sweepNative) {\\n uint256 routerBalance = address(this).balance;\\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\\n } else if (actions[i] == ActionType.oneInch) {\\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\\n data[i],\\n (address, uint256, bytes)\\n );\\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\\n } else if (actions[i] == ActionType.claimRewards) {\\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\\n _claimRewards(user, claimLiquidityGauges);\\n } else if (actions[i] == ActionType.borrower) {\\n (\\n address collateral,\\n address vaultManager,\\n address to,\\n address who,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n bytes memory repayData\\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\\n } else if (actions[i] == ActionType.swapper) {\\n (\\n ISwapper swapperContract,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory payload\\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\\n } else if (actions[i] == ActionType.mint4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _mint4626(savingsRate, shares, to, maxAmountIn);\\n } else if (actions[i] == ActionType.deposit4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626(savingsRate, amount, to, minSharesOut);\\n } else if (actions[i] == ActionType.deposit4626Referral) {\\n (\\n IERC20 token,\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\\n } else if (actions[i] == ActionType.redeem4626) {\\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _redeem4626(savingsRate, shares, to, minAmountOut);\\n } else if (actions[i] == ActionType.withdraw4626) {\\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\\n } else {\\n _chainSpecificAction(actions[i], data[i]);\\n }\\n }\\n }\\n\\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\\n /// addresses depositing from a certain referring address into an ERC4626 contract\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut) {\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n _changeAllowance(IERC20(token), savings, type(uint256).max);\\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\\n }\\n\\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\\n /// actions and then revoking this approval after these actions\\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\\n /// to revoke approvals\\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\\n /// is just an option\\n function mixerVaultManagerPermit(\\n PermitVaultManagerType[] memory paramsPermitVaultManager,\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) external payable virtual {\\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n true,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n } else break;\\n }\\n mixer(paramsPermit, actions, data);\\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\\n // too deep\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (!paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n false,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n }\\n }\\n }\\n\\n receive() external payable {}\\n\\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\\n\\n /// @notice Wraps the native token of a chain to its wrapped version\\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\\n /// @dev The amount to wrap is to be specified in the `msg.value`\\n function _wrapNative() internal virtual returns (uint256) {\\n _getNativeWrapper().deposit{ value: msg.value }();\\n return msg.value;\\n }\\n\\n /// @notice Unwraps the wrapped version of a token to the native chain token\\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\\n amount = _getNativeWrapper().balanceOf(address(this));\\n _slippageCheck(amount, minAmountOut);\\n if (amount != 0) {\\n _getNativeWrapper().withdraw(amount);\\n _safeTransferNative(to, amount);\\n }\\n return amount;\\n }\\n\\n /// @notice Internal version of the `claimRewards` function\\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\\n uint256 gaugesLength = liquidityGauges.length;\\n for (uint256 i; i < gaugesLength; ++i) {\\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\\n }\\n }\\n\\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\\n /// @param vaultManager Address of the vault to perform actions on\\n /// @param actionsBorrow Actions type to perform on the vaultManager\\n /// @param dataBorrow Data needed for each actions\\n /// @param to Address to send the funds to\\n /// @param who Swapper address to handle repayments\\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\\n function _angleBorrower(\\n address vaultManager,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address to,\\n address who,\\n bytes memory repayData\\n ) internal virtual returns (PaymentData memory paymentData) {\\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\\n }\\n\\n /// @notice Sweeps tokens from the router contract\\n /// @param tokenOut Token to sweep\\n /// @param minAmountOut Minimum amount of tokens to recover\\n /// @param to Address to which tokens should be sent\\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\\n _slippageCheck(balanceToken, minAmountOut);\\n if (balanceToken != 0) {\\n IERC20(tokenOut).safeTransfer(to, balanceToken);\\n }\\n }\\n\\n /// @notice Uses an external swapper\\n /// @param swapper Contracts implementing the logic of the swap\\n /// @param inToken Token used to do the swap\\n /// @param outToken Token wanted\\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\\n /// @param inTokenObtained Amount of `inToken` used for the swap\\n /// @param data Additional info for the specific swapper\\n function _swapper(\\n ISwapper swapper,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) internal {\\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\\n }\\n\\n /// @notice Swaps an inToken to another token via 1Inch Router\\n /// @param payload Bytes needed for 1Inch router to process the swap\\n /// @dev The `payload` given is expected to be obtained from 1Inch API\\n function _swapOn1Inch(\\n IERC20 inToken,\\n uint256 minAmountOut,\\n bytes memory payload\\n ) internal returns (uint256 amountOut) {\\n // Approve transfer to the `oneInch` address\\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\\n address oneInchRouter = oneInch;\\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\\n //solhint-disable-next-line\\n (bool success, bytes memory result) = oneInchRouter.call(payload);\\n if (!success) _revertBytes(result);\\n\\n amountOut = abi.decode(result, (uint256));\\n _slippageCheck(amountOut, minAmountOut);\\n }\\n\\n /// @notice Mints `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to mint shares from\\n /// @param shares Amount of shares to mint from the contract\\n /// @param to Address to which shares should be sent\\n /// @param maxAmountIn Max amount of assets used to mint\\n /// @return amountIn Amount of assets used to mint by `to`\\n function _mint4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 maxAmountIn\\n ) internal returns (uint256 amountIn) {\\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\\n }\\n\\n /// @notice Deposits `amount` to an ERC4626 contract\\n /// @param savingsRate The ERC4626 to deposit assets to\\n /// @param amount Amount of assets to deposit\\n /// @param to Address to which shares should be sent\\n /// @param minSharesOut Minimum amount of shares that `to` should received\\n /// @return sharesOut Amount of shares received by `to`\\n function _deposit4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\\n }\\n\\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\\n function _deposit4626Referral(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) internal returns (uint256 sharesOut) {\\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\\n }\\n\\n /// @notice Withdraws `amount` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to withdraw assets from\\n /// @param amount Amount of assets to withdraw\\n /// @param to Destination of assets\\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\\n /// @return sharesOut Amount of shares burnt\\n function _withdraw4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 maxSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\\n }\\n\\n /// @notice Redeems `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to redeem shares from\\n /// @param shares Amount of shares to redeem\\n /// @param to Destination of assets\\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\\n /// @return amountOut Amount of assets received by `to`\\n function _redeem4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 minAmountOut\\n ) internal returns (uint256 amountOut) {\\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\\n }\\n\\n /// @notice Allows to perform some specific actions for a chain\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\\n\\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\\n\\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\\n\\n // ============================ GOVERNANCE FUNCTION ============================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Sets a new `core` contract\\n function setCore(ICoreBorrow _core) external {\\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\\n core = ICoreBorrow(_core);\\n }\\n\\n /// @notice Changes allowances for different tokens\\n /// @param tokens Addresses of the tokens to allow\\n /// @param spenders Addresses to allow transfer\\n /// @param amounts Amounts to allow\\n function changeAllowance(\\n IERC20[] calldata tokens,\\n address[] calldata spenders,\\n uint256[] calldata amounts\\n ) external onlyGovernorOrGuardian {\\n uint256 tokensLength = tokens.length;\\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\\n for (uint256 i; i < tokensLength; ++i) {\\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\\n }\\n }\\n\\n /// @notice Sets a new router variable\\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\\n if (router == address(0)) revert ZeroAddress();\\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\\n else oneInch = router;\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Changes allowance of this contract for a given token\\n /// @param token Address of the token to change allowance\\n /// @param spender Address to change the allowance of\\n /// @param amount Amount allowed\\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\\n } else if (currentAllowance > amount) {\\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\\n }\\n }\\n\\n /// @notice Transfer amount of the native token to the `to` address\\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\\n function _safeTransferNative(address to, uint256 amount) internal {\\n bool success;\\n //solhint-disable-next-line\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n if (!success) revert TransferFailed();\\n }\\n\\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\\n /// the calling address is well approved for all the vaults with which it is interacting\\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\\n /// with a vault are approved for this vault\\n function _parseVaultIDs(\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address vaultManager,\\n address collateral\\n ) internal view returns (bytes[] memory) {\\n uint256 actionsBorrowLength = actionsBorrow.length;\\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\\n bool createVaultAction;\\n uint256 lastVaultID;\\n uint256 vaultIDLength;\\n for (uint256 i; i < actionsBorrowLength; ++i) {\\n uint256 vaultID;\\n // If there is a `createVault` action, the router should not worry about looking at\\n // next vaultIDs given equal to 0\\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\\n createVaultAction = true;\\n continue;\\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\\n // as collateral the full contract balance\\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\\n uint256 amount;\\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\\n if (amount == type(uint256).max)\\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\\n continue;\\n // There are different ways depending on the action to find the `vaultID` to parse\\n } else if (\\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\\n ) {\\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\\n vaultID = abi.decode(dataBorrow[i], (uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\\n } else continue;\\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\\n // if there has not been any specific action\\n if (vaultID == 0) {\\n if (createVaultAction) {\\n continue;\\n } else {\\n // If we haven't stored the last `vaultID`, we need to fetch it\\n if (lastVaultID == 0) {\\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\\n }\\n vaultID = lastVaultID;\\n }\\n }\\n\\n // Check if this `vaultID` has already been verified\\n for (uint256 j; j < vaultIDLength; ++j) {\\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\\n // If yes, we continue to the next iteration\\n continue;\\n }\\n }\\n // Verify this new `vaultID` and add it to the list\\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\\n revert NotApprovedOrOwner();\\n }\\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\\n vaultIDLength += 1;\\n }\\n return dataBorrow;\\n }\\n\\n /// @notice Checks whether the amount obtained during a swap is not too small\\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\\n if (amount < thresholdAmount) revert TooSmallAmountOut();\\n }\\n\\n /// @notice Internal function used for error handling\\n function _revertBytes(bytes memory errMsg) internal pure {\\n if (errMsg.length != 0) {\\n //solhint-disable-next-line\\n assembly {\\n revert(add(32, errMsg), mload(errMsg))\\n }\\n }\\n revert InvalidReturnMessage();\\n }\\n}\\n\",\"keccak256\":\"0x5b45e51240ed42ae858c34a0e7e15003885bd998d3a47da7a4fa5604b69f5c2f\",\"license\":\"GPL-3.0\"},\"contracts/implementations/gnosis/AngleRouterGnosis.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"../../BaseRouter.sol\\\";\\n\\n/// @title AngleRouterGnosis\\n/// @author Angle Core Team\\n/// @notice Router contract built specifially for Angle use cases on Gnosis\\ncontract AngleRouterGnosis is BaseRouter {\\n /// @inheritdoc BaseRouter\\n function _getNativeWrapper() internal pure override returns (IWETH9) {\\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\\n }\\n}\\n\",\"keccak256\":\"0xd49029db9eda5bc6919683e0ff88d29cbf2848dbf3c03426955e7bde5bfa1e1d\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ICoreBorrow.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICoreBorrow\\n/// @author Angle Core Team\\n/// @notice Interface for the `CoreBorrow` contract\\n\\ninterface ICoreBorrow {\\n /// @notice Checks whether an address is governor of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2414539c445977b04bc7e9adac2e5147364994dd74e5d7118b44824956de602c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDepositWithReferral.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IDepositWithReferral\\n/// @author Angle Core Team\\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\\ninterface IDepositWithReferral {\\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\\n /// obtained, the function reverts\\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\\n /// when a deposit takes place\\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut);\\n}\\n\",\"keccak256\":\"0x69b88fa9ec5111394843f54f312c3b8c1b47490c76109a97ba90e4ac5697e960\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ILiquidityGauge.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface ILiquidityGauge {\\n // solhint-disable-next-line\\n function staking_token() external returns (address stakingToken);\\n\\n // solhint-disable-next-line\\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\\n\\n function deposit(\\n uint256 _value,\\n address _addr,\\n // solhint-disable-next-line\\n bool _claim_rewards\\n ) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr, address _receiver) external;\\n}\\n\",\"keccak256\":\"0x27144c21760603a4e441bb5eecf975ad7f71331ac0ba0a83352b280ccf734756\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\n/// @title ISwapper\\n/// @author Angle Core Team\\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\\ninterface ISwapper {\\n function swap(\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0x506f50d8447c2dc662bd844779cc66a407af07a91210612b956ef47abcc15776\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITreasury.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ITreasury\\n/// @author Angle Core Team\\n/// @notice Interface for the `Treasury` contract\\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\\n/// of this module\\ninterface ITreasury {\\n /// @notice Checks whether a given address has well been initialized in this contract\\n /// as a `VaultManager``\\n /// @param _vaultManager Address to check\\n /// @return Whether the address has been initialized or not\\n function isVaultManager(address _vaultManager) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x36bd50a0ab1c46503bb64b8d5777bf3b4fd2da0e2dcfe68c8a9702eb132eb3e2\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVaultManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./ITreasury.sol\\\";\\n\\n// ========================= Key Structs and Enums =============================\\n\\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\\n/// to the caller or associated addresses\\nstruct PaymentData {\\n // Stablecoin amount the contract should give\\n uint256 stablecoinAmountToGive;\\n // Stablecoin amount owed to the contract\\n uint256 stablecoinAmountToReceive;\\n // Collateral amount the contract should give\\n uint256 collateralAmountToGive;\\n // Collateral amount owed to the contract\\n uint256 collateralAmountToReceive;\\n}\\n\\n/// @notice Data stored to track someone's loan (or equivalently called position)\\nstruct Vault {\\n // Amount of collateral deposited in the vault\\n uint256 collateralAmount;\\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\\n uint256 normalizedDebt;\\n}\\n\\n/// @notice Actions possible when composing calls to the different entry functions proposed\\nenum ActionBorrowType {\\n createVault,\\n closeVault,\\n addCollateral,\\n removeCollateral,\\n repayDebt,\\n borrow,\\n getDebtIn,\\n permit\\n}\\n\\n// ========================= Interfaces =============================\\n\\n/// @title IVaultManagerFunctions\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface only contains functions of the contract which are called by other contracts\\n/// of this module (without getters)\\ninterface IVaultManagerFunctions {\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\\n /// @param repayData Data to pass to the repayment contract in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to,\\n address who,\\n bytes memory repayData\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Checks whether a given address is approved for a vault or owns this vault\\n /// @param spender Address for which vault ownership should be checked\\n /// @param vaultID ID of the vault to check\\n /// @return Whether the `spender` address owns or is approved for `vaultID`\\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\\n\\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\\n /// @param spender Address to give approval to\\n /// @param approved Whether to give or revoke the approval\\n /// @param deadline Deadline parameter for the signature to be valid\\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\\n function permit(\\n address owner,\\n address spender,\\n bool approved,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\\n/// @title IVaultManagerStorage\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface contains getters of the contract's public variables used by other contracts\\n/// of this module\\ninterface IVaultManagerStorage {\\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\\n function treasury() external view returns (ITreasury);\\n\\n /// @notice Reference to the collateral handled by this `VaultManager`\\n function collateral() external view returns (IERC20);\\n\\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\\n function vaultIDCount() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4cf6dc5e5b494165e4d9e524dca5c65f6307e5b005a62287c5e84f1539dc81f1\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title Interface for WETH9\\ninterface IWETH9 is IERC20 {\\n /// @notice Deposit ether to get wrapped ether\\n function deposit() external payable;\\n\\n /// @notice Withdraw wrapped ether to get ether\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0xb109c1d668416c05f61d6edea2ec7a10b2f8b386fd51a59cc12f929c73d00424\",\"license\":\"GPL-2.0-or-later\"},\"contracts/interfaces/external/uniswap/IUniswapRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nstruct ExactInputParams {\\n bytes path;\\n address recipient;\\n uint256 deadline;\\n uint256 amountIn;\\n uint256 amountOutMinimum;\\n}\\n\\n/// @title Router token swapping functionality\\n/// @notice Functions for swapping tokens via Uniswap V3\\ninterface IUniswapV3Router {\\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\\n /// @return amountOut The amount of the received token\\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\\n}\\n\\n/// @title Router for price estimation functionality\\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\\n/// @dev This interface is only used for non critical elements of the protocol\\ninterface IUniswapV2Router {\\n /// @notice Given an input asset amount, returns the maximum output amount of the\\n /// other asset (accounting for fees) given reserves.\\n /// @param path Addresses of the pools used to get prices\\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\\n\\n function swapExactTokensForTokens(\\n uint256 swapAmount,\\n uint256 minExpected,\\n address[] calldata path,\\n address receiver,\\n uint256 swapDeadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x1908fcdc6ff78ad2250f6ccacc7129df464a648cb2a5f376bedbe506d058bb73\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620018d51760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b613f52806200015c6000396000f3fe6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073e91d153e0b41518a2ce8dd3d7944fa863463a97d73ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b600073e91d153e0b41518a2ce8dd3d7944fa863463a97d6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273e91d153e0b41518a2ce8dd3d7944fa863463a97d90632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220dee77fba9f8779b8a7ced714bb51e08aad5bdcf0bd47da48640dccc6b1baead964736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073e91d153e0b41518a2ce8dd3d7944fa863463a97d73ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b600073e91d153e0b41518a2ce8dd3d7944fa863463a97d6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273e91d153e0b41518a2ce8dd3d7944fa863463a97d90632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220dee77fba9f8779b8a7ced714bb51e08aad5bdcf0bd47da48640dccc6b1baead964736f6c63430008110033", + "devdoc": { + "author": "Angle Core Team", + "kind": "dev", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "params": { + "amounts": "Amounts to allow", + "spenders": "Addresses to allow transfer", + "tokens": "Addresses of the tokens to allow" + } + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens", + "params": { + "actions": "List of actions to be performed by the router (in order of execution)", + "data": "Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored", + "paramsPermit": "Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it" + } + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option", + "params": { + "paramsPermitVaultManager": "Parameters to sign permit to give allowance to the router for a `VaultManager` contract" + } + } + }, + "title": "AngleRouterGnosis", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "notice": "Changes allowances for different tokens" + }, + "core()": { + "notice": "Core address handling access control" + }, + "deposit4626Referral(address,address,uint256,address,uint256,address)": { + "notice": "Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract" + }, + "initializeRouter(address,address,address)": { + "notice": "Deploys the router contract on a chain" + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Allows composable calls to different functions within the protocol" + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions" + }, + "oneInch()": { + "notice": "Address of 1Inch router used for swaps" + }, + "setCore(address)": { + "notice": "Sets a new `core` contract" + }, + "setRouter(address,uint8)": { + "notice": "Sets a new router variable" + }, + "uniswapV3Router()": { + "notice": "Address of the router used for swaps" + } + }, + "notice": "Router contract built specifially for Angle use cases on Gnosis", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6, + "contract": "contracts/implementations/gnosis/AngleRouterGnosis.sol:AngleRouterGnosis", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 9, + "contract": "contracts/implementations/gnosis/AngleRouterGnosis.sol:AngleRouterGnosis", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 1478, + "contract": "contracts/implementations/gnosis/AngleRouterGnosis.sol:AngleRouterGnosis", + "label": "core", + "offset": 2, + "slot": "0", + "type": "t_contract(ICoreBorrow)3793" + }, + { + "astId": 1482, + "contract": "contracts/implementations/gnosis/AngleRouterGnosis.sol:AngleRouterGnosis", + "label": "uniswapV3Router", + "offset": 0, + "slot": "1", + "type": "t_contract(IUniswapV3Router)4262" + }, + { + "astId": 1485, + "contract": "contracts/implementations/gnosis/AngleRouterGnosis.sol:AngleRouterGnosis", + "label": "oneInch", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 1489, + "contract": "contracts/implementations/gnosis/AngleRouterGnosis.sol:AngleRouterGnosis", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint256)47_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ICoreBorrow)3793": { + "encoding": "inplace", + "label": "contract ICoreBorrow", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Router)4262": { + "encoding": "inplace", + "label": "contract IUniswapV3Router", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/gnosis/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json b/deployments/gnosis/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json new file mode 100644 index 0000000..c75418b --- /dev/null +++ b/deployments/gnosis/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json @@ -0,0 +1,142 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\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 IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\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 require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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 */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\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. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/BaseRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport \"./interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./interfaces/external/IWETH9.sol\";\nimport \"./interfaces/ICoreBorrow.sol\";\nimport \"./interfaces/IDepositWithReferral.sol\";\nimport \"./interfaces/ILiquidityGauge.sol\";\nimport \"./interfaces/ISwapper.sol\";\nimport \"./interfaces/IVaultManager.sol\";\n\n// ============================== STRUCTS AND ENUM =============================\n\n/// @notice Action types\nenum ActionType {\n transfer,\n wrapNative,\n unwrapNative,\n sweep,\n sweepNative,\n // Deprecated\n uniswapV3,\n oneInch,\n claimRewards,\n // Deprecated\n gaugeDeposit,\n borrower,\n swapper,\n mint4626,\n deposit4626,\n redeem4626,\n withdraw4626,\n // Deprecated\n prepareRedeemSavingsRate,\n // Deprecated\n claimRedeemSavingsRate,\n // Deprecated\n swapIn,\n // Deprecated\n swapOut,\n claimWeeklyInterest,\n // Deprecated\n withdraw,\n // Deprecated\n mint,\n // Deprecated\n deposit,\n // Deprecated\n openPerpetual,\n // Deprecated\n addToPerpetual,\n veANGLEDeposit,\n // Deprecated\n claimRewardsWithPerps,\n deposit4626Referral\n}\n\n/// @notice Data needed to get permits\nstruct PermitType {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @notice Data to grant permit to the router for a vault\nstruct PermitVaultManagerType {\n address vaultManager;\n address owner;\n bool approved;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @title BaseRouter\n/// @author Angle Core Team\n/// @notice Base contract that Angle router contracts on different chains should override\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\n using SafeERC20 for IERC20;\n\n // ================================= REFERENCES ================================\n\n /// @notice Core address handling access control\n ICoreBorrow public core;\n /// @notice Address of the router used for swaps\n IUniswapV3Router public uniswapV3Router;\n /// @notice Address of 1Inch router used for swaps\n address public oneInch;\n\n uint256[47] private __gap;\n\n // ============================== EVENTS / ERRORS ==============================\n\n error IncompatibleLengths();\n error InvalidReturnMessage();\n error NotApprovedOrOwner();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error TooSmallAmountOut();\n error TransferFailed();\n error ZeroAddress();\n\n event ReferredDeposit(\n address caller,\n address indexed owner,\n uint256 assets,\n uint256 shares,\n address indexed savings,\n address indexed referrer\n );\n\n /// @notice Deploys the router contract on a chain\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\n if (_core == address(0)) revert ZeroAddress();\n core = ICoreBorrow(_core);\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\n oneInch = _oneInch;\n }\n\n constructor() initializer {}\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @notice Allows composable calls to different functions within the protocol\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\n /// @param actions List of actions to be performed by the router (in order of execution)\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\n /// for a given action are stored\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\n /// do not perform a sweep action on these tokens\n function mixer(\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) public payable virtual {\n // If all tokens have already been approved, there's no need for this step\n uint256 permitsLength = paramsPermit.length;\n for (uint256 i; i < permitsLength; ++i) {\n IERC20Permit(paramsPermit[i].token).permit(\n paramsPermit[i].owner,\n address(this),\n paramsPermit[i].value,\n paramsPermit[i].deadline,\n paramsPermit[i].v,\n paramsPermit[i].r,\n paramsPermit[i].s\n );\n }\n // Performing actions one after the others\n uint256 actionsLength = actions.length;\n for (uint256 i; i < actionsLength; ++i) {\n if (actions[i] == ActionType.transfer) {\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\n } else if (actions[i] == ActionType.wrapNative) {\n _wrapNative();\n } else if (actions[i] == ActionType.unwrapNative) {\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\n _unwrapNative(minAmountOut, to);\n } else if (actions[i] == ActionType.sweep) {\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\n _sweep(tokenOut, minAmountOut, to);\n } else if (actions[i] == ActionType.sweepNative) {\n uint256 routerBalance = address(this).balance;\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\n } else if (actions[i] == ActionType.oneInch) {\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\n data[i],\n (address, uint256, bytes)\n );\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\n } else if (actions[i] == ActionType.claimRewards) {\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\n _claimRewards(user, claimLiquidityGauges);\n } else if (actions[i] == ActionType.borrower) {\n (\n address collateral,\n address vaultManager,\n address to,\n address who,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n bytes memory repayData\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\n } else if (actions[i] == ActionType.swapper) {\n (\n ISwapper swapperContract,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory payload\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\n } else if (actions[i] == ActionType.mint4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _mint4626(savingsRate, shares, to, maxAmountIn);\n } else if (actions[i] == ActionType.deposit4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626(savingsRate, amount, to, minSharesOut);\n } else if (actions[i] == ActionType.deposit4626Referral) {\n (\n IERC20 token,\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\n } else if (actions[i] == ActionType.redeem4626) {\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _redeem4626(savingsRate, shares, to, minAmountOut);\n } else if (actions[i] == ActionType.withdraw4626) {\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\n } else {\n _chainSpecificAction(actions[i], data[i]);\n }\n }\n }\n\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\n /// addresses depositing from a certain referring address into an ERC4626 contract\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n _changeAllowance(IERC20(token), savings, type(uint256).max);\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\n }\n\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\n /// actions and then revoking this approval after these actions\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\n /// to revoke approvals\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\n /// is just an option\n function mixerVaultManagerPermit(\n PermitVaultManagerType[] memory paramsPermitVaultManager,\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) external payable virtual {\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n true,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n } else break;\n }\n mixer(paramsPermit, actions, data);\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\n // too deep\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (!paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n false,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n }\n }\n }\n\n receive() external payable {}\n\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\n\n /// @notice Wraps the native token of a chain to its wrapped version\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\n /// @dev The amount to wrap is to be specified in the `msg.value`\n function _wrapNative() internal virtual returns (uint256) {\n _getNativeWrapper().deposit{ value: msg.value }();\n return msg.value;\n }\n\n /// @notice Unwraps the wrapped version of a token to the native chain token\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\n amount = _getNativeWrapper().balanceOf(address(this));\n _slippageCheck(amount, minAmountOut);\n if (amount != 0) {\n _getNativeWrapper().withdraw(amount);\n _safeTransferNative(to, amount);\n }\n return amount;\n }\n\n /// @notice Internal version of the `claimRewards` function\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\n uint256 gaugesLength = liquidityGauges.length;\n for (uint256 i; i < gaugesLength; ++i) {\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\n }\n }\n\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\n /// @param vaultManager Address of the vault to perform actions on\n /// @param actionsBorrow Actions type to perform on the vaultManager\n /// @param dataBorrow Data needed for each actions\n /// @param to Address to send the funds to\n /// @param who Swapper address to handle repayments\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\n function _angleBorrower(\n address vaultManager,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address to,\n address who,\n bytes memory repayData\n ) internal virtual returns (PaymentData memory paymentData) {\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\n }\n\n /// @notice Sweeps tokens from the router contract\n /// @param tokenOut Token to sweep\n /// @param minAmountOut Minimum amount of tokens to recover\n /// @param to Address to which tokens should be sent\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\n _slippageCheck(balanceToken, minAmountOut);\n if (balanceToken != 0) {\n IERC20(tokenOut).safeTransfer(to, balanceToken);\n }\n }\n\n /// @notice Uses an external swapper\n /// @param swapper Contracts implementing the logic of the swap\n /// @param inToken Token used to do the swap\n /// @param outToken Token wanted\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\n /// @param inTokenObtained Amount of `inToken` used for the swap\n /// @param data Additional info for the specific swapper\n function _swapper(\n ISwapper swapper,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) internal {\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\n }\n\n /// @notice Swaps an inToken to another token via 1Inch Router\n /// @param payload Bytes needed for 1Inch router to process the swap\n /// @dev The `payload` given is expected to be obtained from 1Inch API\n function _swapOn1Inch(\n IERC20 inToken,\n uint256 minAmountOut,\n bytes memory payload\n ) internal returns (uint256 amountOut) {\n // Approve transfer to the `oneInch` address\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\n address oneInchRouter = oneInch;\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\n //solhint-disable-next-line\n (bool success, bytes memory result) = oneInchRouter.call(payload);\n if (!success) _revertBytes(result);\n\n amountOut = abi.decode(result, (uint256));\n _slippageCheck(amountOut, minAmountOut);\n }\n\n /// @notice Mints `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to mint shares from\n /// @param shares Amount of shares to mint from the contract\n /// @param to Address to which shares should be sent\n /// @param maxAmountIn Max amount of assets used to mint\n /// @return amountIn Amount of assets used to mint by `to`\n function _mint4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 maxAmountIn\n ) internal returns (uint256 amountIn) {\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\n }\n\n /// @notice Deposits `amount` to an ERC4626 contract\n /// @param savingsRate The ERC4626 to deposit assets to\n /// @param amount Amount of assets to deposit\n /// @param to Address to which shares should be sent\n /// @param minSharesOut Minimum amount of shares that `to` should received\n /// @return sharesOut Amount of shares received by `to`\n function _deposit4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\n }\n\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\n function _deposit4626Referral(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) internal returns (uint256 sharesOut) {\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\n }\n\n /// @notice Withdraws `amount` from an ERC4626 contract\n /// @param savingsRate ERC4626 to withdraw assets from\n /// @param amount Amount of assets to withdraw\n /// @param to Destination of assets\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\n /// @return sharesOut Amount of shares burnt\n function _withdraw4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 maxSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\n }\n\n /// @notice Redeems `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to redeem shares from\n /// @param shares Amount of shares to redeem\n /// @param to Destination of assets\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\n /// @return amountOut Amount of assets received by `to`\n function _redeem4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 minAmountOut\n ) internal returns (uint256 amountOut) {\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\n }\n\n /// @notice Allows to perform some specific actions for a chain\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\n\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\n\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\n\n // ============================ GOVERNANCE FUNCTION ============================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Sets a new `core` contract\n function setCore(ICoreBorrow _core) external {\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\n core = ICoreBorrow(_core);\n }\n\n /// @notice Changes allowances for different tokens\n /// @param tokens Addresses of the tokens to allow\n /// @param spenders Addresses to allow transfer\n /// @param amounts Amounts to allow\n function changeAllowance(\n IERC20[] calldata tokens,\n address[] calldata spenders,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\n for (uint256 i; i < tokensLength; ++i) {\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\n }\n }\n\n /// @notice Sets a new router variable\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\n if (router == address(0)) revert ZeroAddress();\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\n else oneInch = router;\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Changes allowance of this contract for a given token\n /// @param token Address of the token to change allowance\n /// @param spender Address to change the allowance of\n /// @param amount Amount allowed\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\n uint256 currentAllowance = token.allowance(address(this), spender);\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\n } else if (currentAllowance > amount) {\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\n }\n }\n\n /// @notice Transfer amount of the native token to the `to` address\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\n function _safeTransferNative(address to, uint256 amount) internal {\n bool success;\n //solhint-disable-next-line\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) revert TransferFailed();\n }\n\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\n /// the calling address is well approved for all the vaults with which it is interacting\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\n /// with a vault are approved for this vault\n function _parseVaultIDs(\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address vaultManager,\n address collateral\n ) internal view returns (bytes[] memory) {\n uint256 actionsBorrowLength = actionsBorrow.length;\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\n bool createVaultAction;\n uint256 lastVaultID;\n uint256 vaultIDLength;\n for (uint256 i; i < actionsBorrowLength; ++i) {\n uint256 vaultID;\n // If there is a `createVault` action, the router should not worry about looking at\n // next vaultIDs given equal to 0\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\n createVaultAction = true;\n continue;\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\n // as collateral the full contract balance\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\n uint256 amount;\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\n if (amount == type(uint256).max)\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\n continue;\n // There are different ways depending on the action to find the `vaultID` to parse\n } else if (\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\n ) {\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\n vaultID = abi.decode(dataBorrow[i], (uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\n } else continue;\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\n // if there has not been any specific action\n if (vaultID == 0) {\n if (createVaultAction) {\n continue;\n } else {\n // If we haven't stored the last `vaultID`, we need to fetch it\n if (lastVaultID == 0) {\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\n }\n vaultID = lastVaultID;\n }\n }\n\n // Check if this `vaultID` has already been verified\n for (uint256 j; j < vaultIDLength; ++j) {\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\n // If yes, we continue to the next iteration\n continue;\n }\n }\n // Verify this new `vaultID` and add it to the list\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\n revert NotApprovedOrOwner();\n }\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\n vaultIDLength += 1;\n }\n return dataBorrow;\n }\n\n /// @notice Checks whether the amount obtained during a swap is not too small\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\n if (amount < thresholdAmount) revert TooSmallAmountOut();\n }\n\n /// @notice Internal function used for error handling\n function _revertBytes(bytes memory errMsg) internal pure {\n if (errMsg.length != 0) {\n //solhint-disable-next-line\n assembly {\n revert(add(32, errMsg), mload(errMsg))\n }\n }\n revert InvalidReturnMessage();\n }\n}\n" + }, + "contracts/implementations/arbitrum/AngleRouterArbitrum.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterArbitrum\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\ncontract AngleRouterArbitrum is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n }\n}\n" + }, + "contracts/implementations/avalanche/AngleRouterAvalanche.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterAvalanche\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Avalanche\ncontract AngleRouterAvalanche is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n }\n}\n" + }, + "contracts/implementations/base/AngleRouterBase.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterBase\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Base\ncontract AngleRouterBase is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/celo/AngleRouterCelo.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterCelo\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Celo\ncontract AngleRouterCelo is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0000000000000000000000000000000000000000);\n }\n}\n" + }, + "contracts/implementations/gnosis/AngleRouterGnosis.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterGnosis\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Gnosis\ncontract AngleRouterGnosis is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n }\n}\n" + }, + "contracts/implementations/mainnet/AngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../interfaces/IFeeDistributorFront.sol\";\nimport \"../../interfaces/ISanToken.sol\";\nimport \"../../interfaces/IStableMasterFront.sol\";\nimport \"../../interfaces/IVeANGLE.sol\";\n\nimport \"../../BaseRouter.sol\";\n\n// ============================= STRUCTS AND ENUMS =============================\n\n/// @notice References to the contracts associated to a collateral for a stablecoin\nstruct Pairs {\n IPoolManager poolManager;\n IPerpetualManagerFrontWithClaim perpetualManager;\n ISanToken sanToken;\n ILiquidityGauge gauge;\n}\n\n/// @title AngleRouterMainnet\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Ethereum\n/// @dev Previous implementation with an initialization function can be found here:\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\ncontract AngleRouterMainnet is BaseRouter {\n using SafeERC20 for IERC20;\n\n // =================================== ERRORS ==================================\n\n error InvalidParams();\n\n // ================================== MAPPINGS =================================\n\n /// @notice Maps an agToken to its counterpart `StableMaster`\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\n\n uint256[48] private __gapMainnet;\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @inheritdoc BaseRouter\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\n if (action == ActionType.claimWeeklyInterest) {\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\n } else if (action == ActionType.veANGLEDeposit) {\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\n _depositOnLocker(user, amount);\n }\n }\n\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n }\n\n /// @notice Deposits ANGLE on an existing locker\n /// @param user Address to deposit for\n /// @param amount Amount to deposit\n function _depositOnLocker(address user, uint256 amount) internal {\n _getVeANGLE().deposit_for(user, amount);\n }\n\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\n /// @param user Address to claim for\n /// @param _feeDistributor Address of the fee distributor to claim to\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\n /// transfer the token claimed from the `feeDistributor`\n function _claimWeeklyInterest(\n address user,\n IFeeDistributorFront _feeDistributor,\n bool letInContract\n ) internal {\n uint256 amount = _feeDistributor.claim(user);\n if (letInContract) {\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\n IERC20 token = IERC20(_feeDistributor.token());\n token.safeTransferFrom(msg.sender, address(this), amount);\n }\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Returns the veANGLE address\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\n }\n}\n" + }, + "contracts/implementations/optimism/AngleRouterOptimism.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterOptimism\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Optimism\ncontract AngleRouterOptimism is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/polygon/AngleRouterPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterPolygon\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Polygon\ncontract AngleRouterPolygon is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n }\n}\n" + }, + "contracts/interfaces/external/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nstruct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n}\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IUniswapV3Router {\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n\n/// @title Router for price estimation functionality\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\n/// @dev This interface is only used for non critical elements of the protocol\ninterface IUniswapV2Router {\n /// @notice Given an input asset amount, returns the maximum output amount of the\n /// other asset (accounting for fees) given reserves.\n /// @param path Addresses of the pools used to get prices\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokens(\n uint256 swapAmount,\n uint256 minExpected,\n address[] calldata path,\n address receiver,\n uint256 swapDeadline\n ) external;\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICoreBorrow\n/// @author Angle Core Team\n/// @notice Interface for the `CoreBorrow` contract\n\ninterface ICoreBorrow {\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IDepositWithReferral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title IDepositWithReferral\n/// @author Angle Core Team\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\ninterface IDepositWithReferral {\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\n /// obtained, the function reverts\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\n /// when a deposit takes place\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut);\n}\n" + }, + "contracts/interfaces/IFeeDistributorFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IFeeDistributorFront\n/// @author Interface for public use of the `FeeDistributor` contract\n/// @dev This interface is used for user related function\ninterface IFeeDistributorFront {\n function token() external returns (address);\n\n function claim(address _addr) external returns (uint256);\n\n function claim(address[20] memory _addr) external returns (bool);\n}\n" + }, + "contracts/interfaces/ILiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function staking_token() external returns (address stakingToken);\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external;\n}\n" + }, + "contracts/interfaces/IPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title Interface of the contract managing perpetuals with claim function\n/// @author Angle Core Team\n/// @dev Front interface with rewards function, meaning only user-facing functions\ninterface IPerpetualManagerFrontWithClaim {\n function getReward(uint256 perpetualID) external;\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\n\n function openPerpetual(\n address owner,\n uint256 amountBrought,\n uint256 amountCommitted,\n uint256 maxOracleRate,\n uint256 minNetMargin\n ) external returns (uint256 perpetualID);\n}\n" + }, + "contracts/interfaces/IPoolManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IPoolManager {\n function token() external view returns (address);\n}\n" + }, + "contracts/interfaces/ISanToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ISanToken is IERC20Upgradeable {}\n" + }, + "contracts/interfaces/IStableMasterFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IPoolManager.sol\";\nimport \"./ISanToken.sol\";\nimport \"./IPerpetualManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Struct to handle all the parameters to manage the fees\n// related to a given collateral pool (associated to the stablecoin)\nstruct MintBurnData {\n // Values of the thresholds to compute the minting fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeMint;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeMint;\n // Values of the thresholds to compute the burning fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeBurn;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeBurn;\n // Max proportion of collateral from users that can be covered by HAs\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\n // the other changes accordingly\n uint64 targetHAHedge;\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusMint;\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusBurn;\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\n uint256 capOnStableMinted;\n}\n\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\n// including the fraction of interests they receive or the fees to be distributed to\n// them\nstruct SLPData {\n // Last timestamp at which the `sanRate` has been updated for SLPs\n uint256 lastBlockUpdated;\n // Fees accumulated from previous blocks and to be distributed to SLPs\n uint256 lockedInterests;\n // Max interests used to update the `sanRate` in a single block\n // Should be in collateral token base\n uint256 maxInterestsDistributed;\n // Amount of fees left aside for SLPs and that will be distributed\n // when the protocol is collateralized back again\n uint256 feesAside;\n // Part of the fees normally going to SLPs that is left aside\n // before the protocol is collateralized back again (depends on collateral ratio)\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippageFee;\n // Portion of the fees from users minting and burning\n // that goes to SLPs (the rest goes to surplus)\n uint64 feesForSLPs;\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippage;\n // Portion of the interests from lending\n // that goes to SLPs (the rest goes to surplus)\n uint64 interestsForSLPs;\n}\n\n/// @title IStableMasterFront\n/// @author Angle Core Team\n/// @dev Front interface, meaning only user-facing functions\ninterface IStableMasterFront {\n function collateralMap(IPoolManager poolManager)\n external\n view\n returns (\n IERC20 token,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n address oracle,\n uint256 stocksUsers,\n uint256 sanRate,\n uint256 collatBase,\n SLPData memory slpData,\n MintBurnData memory feeData\n );\n\n function updateStocksUsers(uint256 amount, address poolManager) external;\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256 minStableAmount\n ) external;\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256 minCollatAmount\n ) external;\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external;\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external;\n\n function agToken() external returns (address);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Core Team\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\ninterface ISwapper {\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager``\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\n uint256 normalizedDebt;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionBorrowType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IVeANGLE\n/// @author Angle Core Team\n/// @notice Interface for the `VeANGLE` contract\ninterface IVeANGLE {\n // solhint-disable-next-line func-name-mixedcase\n function deposit_for(address addr, uint256 amount) external;\n}\n" + }, + "contracts/mock/MockAngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../implementations/mainnet/AngleRouterMainnet.sol\";\n\ncontract MockAngleRouterMainnet is AngleRouterMainnet {\n address public veAngle;\n\n function setAngleAndVeANGLE(address _veAngle) external {\n veAngle = _veAngle;\n }\n\n function _getVeANGLE() internal view override returns (IVeANGLE) {\n return IVeANGLE(veAngle);\n }\n\n function addStableMaster(IERC20 stablecoin, IStableMasterFront stableMaster) external {\n mapStableMasters[stablecoin] = stableMaster;\n }\n\n function addPairs(\n IERC20[] calldata stablecoins,\n IPoolManager[] calldata poolManagers,\n ILiquidityGauge[] calldata liquidityGauges,\n bool[] calldata justLiquidityGauges\n ) external {\n for (uint256 i; i < stablecoins.length; ++i) {\n IStableMasterFront stableMaster = mapStableMasters[stablecoins[i]];\n _addPair(stableMaster, poolManagers[i], liquidityGauges[i], justLiquidityGauges[i]);\n }\n }\n\n function _addPair(\n IStableMasterFront stableMaster,\n IPoolManager poolManager,\n ILiquidityGauge liquidityGauge,\n bool justLiquidityGauge\n ) internal {\n // Fetching the associated `sanToken` and `perpetualManager` from the contract\n (\n IERC20 collateral,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n ,\n ,\n ,\n ,\n ,\n\n ) = stableMaster.collateralMap(poolManager);\n // Reverting if the poolManager is not a valid `poolManager`\n if (address(collateral) == address(0)) revert InvalidParams();\n Pairs storage _pairs = mapPoolManagers[stableMaster][collateral];\n if (justLiquidityGauge) {\n // Cannot specify a liquidity gauge if the associated poolManager does not exist\n if (address(_pairs.poolManager) == address(0)) revert ZeroAddress();\n ILiquidityGauge gauge = _pairs.gauge;\n if (address(gauge) != address(0)) {\n _changeAllowance(IERC20(address(sanToken)), address(gauge), 0);\n }\n } else {\n // Checking if the pair has not already been initialized: if yes we need to make the function revert\n // otherwise we could end up with still approved `PoolManager` and `PerpetualManager` contracts\n if (address(_pairs.poolManager) != address(0)) revert InvalidParams();\n _pairs.poolManager = poolManager;\n _pairs.perpetualManager = IPerpetualManagerFrontWithClaim(address(perpetualManager));\n _pairs.sanToken = sanToken;\n _changeAllowance(collateral, address(stableMaster), type(uint256).max);\n _changeAllowance(collateral, address(perpetualManager), type(uint256).max);\n }\n _pairs.gauge = liquidityGauge;\n if (address(liquidityGauge) != address(0)) {\n if (address(sanToken) != liquidityGauge.staking_token()) revert InvalidParams();\n _changeAllowance(IERC20(address(sanToken)), address(liquidityGauge), type(uint256).max);\n }\n }\n}\n\ncontract MockAngleRouterMainnet2 is AngleRouterMainnet {\n function getVeANGLE() external view returns (IVeANGLE) {\n return _getVeANGLE();\n }\n}\n" + }, + "contracts/mock/MockRouterSidechain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/external/IWETH9.sol\";\n\nimport \"../BaseRouter.sol\";\n\n/// @title MockRouterSidechain\n/// @author Angle Core Team\n/// @notice Mock contract but built for tests as if to be deployed on Ethereum\ncontract MockRouterSidechain is BaseRouter {\n IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function _wrapNative() internal pure override returns (uint256) {\n return 0;\n }\n\n function _unwrapNative(uint256, address) internal pure override returns (uint256 amount) {\n return 0;\n }\n\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return WETH;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/linea/.chainId b/deployments/linea/.chainId new file mode 100644 index 0000000..c9e6af4 --- /dev/null +++ b/deployments/linea/.chainId @@ -0,0 +1 @@ +59144 \ No newline at end of file diff --git a/deployments/linea/AngleRouterLineaV2.json b/deployments/linea/AngleRouterLineaV2.json new file mode 100644 index 0000000..842ce24 --- /dev/null +++ b/deployments/linea/AngleRouterLineaV2.json @@ -0,0 +1,247 @@ +{ + "address": "0xdaCC848E19Ff431EE6E8A48975dd8206CaDa9F8B", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x24cd4f4a38b4e47be0a85ccad6fb886e56195373b37ae8884bfdfeba5458b9f6", + "receipt": { + "to": null, + "from": "0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185", + "contractAddress": "0xdaCC848E19Ff431EE6E8A48975dd8206CaDa9F8B", + "transactionIndex": 5, + "gasUsed": "718558", + "logsBloom": "0x00000000000000000200000000000000400000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000010000000002000000000000000000100000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000080000000000000800000000000000000000000000000020400000000000000000000000000000000000000000020000000000000000000040000100000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x33a92f73ee36f702fc085974278ee5ac6571c2c7ef9e49a352ba56eb435aa1c4", + "transactionHash": "0x24cd4f4a38b4e47be0a85ccad6fb886e56195373b37ae8884bfdfeba5458b9f6", + "logs": [ + { + "transactionIndex": 5, + "blockNumber": 6959289, + "transactionHash": "0x24cd4f4a38b4e47be0a85ccad6fb886e56195373b37ae8884bfdfeba5458b9f6", + "address": "0xdaCC848E19Ff431EE6E8A48975dd8206CaDa9F8B", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000009a33e690aa78a4c346e72f7a5e16e5d7278be835" + ], + "data": "0x", + "logIndex": 6, + "blockHash": "0x33a92f73ee36f702fc085974278ee5ac6571c2c7ef9e49a352ba56eb435aa1c4" + }, + { + "transactionIndex": 5, + "blockNumber": 6959289, + "transactionHash": "0x24cd4f4a38b4e47be0a85ccad6fb886e56195373b37ae8884bfdfeba5458b9f6", + "address": "0xdaCC848E19Ff431EE6E8A48975dd8206CaDa9F8B", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 7, + "blockHash": "0x33a92f73ee36f702fc085974278ee5ac6571c2c7ef9e49a352ba56eb435aa1c4" + }, + { + "transactionIndex": 5, + "blockNumber": 6959289, + "transactionHash": "0x24cd4f4a38b4e47be0a85ccad6fb886e56195373b37ae8884bfdfeba5458b9f6", + "address": "0xdaCC848E19Ff431EE6E8A48975dd8206CaDa9F8B", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000d9f1a8e00b0eebedddd9afeab55019d55fcec017", + "logIndex": 8, + "blockHash": "0x33a92f73ee36f702fc085974278ee5ac6571c2c7ef9e49a352ba56eb435aa1c4" + } + ], + "blockNumber": 6959289, + "cumulativeGasUsed": "1042029", + "status": 1, + "byzantium": true + }, + "args": [ + "0x9A33e690AA78A4c346e72f7A5e16e5d7278BE835", + "0xD9F1A8e00b0EEbeDddd9aFEaB55019D55fcec017", + "0x42860d4b0000000000000000000000005bc6bef80da563ebf6df6d6913513fa9a7ec89be00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "numDeployments": 1, + "solcInputHash": "2560f9a5795a08bc300fefd5eee2c52b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin `TransparentUpgradeableProxy` To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/external/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/external/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin\\n * `TransparentUpgradeableProxy`\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xdbb2775fbc740793c0b3d5927cca8b9976cc4f9caef50178d1be0aa7afca14e6\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x6080604052604051620010bb380380620010bb8339810160408190526200002691620004d8565b828162000036828260006200009a565b5062000066905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005b8565b6000805160206200107483398151915214620000865762000086620005da565b6200009182620000d7565b50505062000643565b620000a58362000132565b600082511180620000b35750805b15620000d257620000d083836200017460201b6200028c1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f62000102620001a5565b604080516001600160a01b03928316815291841660208301520160405180910390a16200012f81620001de565b50565b6200013d8162000293565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606200019c8383604051806060016040528060278152602001620010946027913962000347565b90505b92915050565b6000620001cf6000805160206200107483398151915260001b6200042f60201b6200022e1760201c565b546001600160a01b0316919050565b6001600160a01b038116620002495760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002726000805160206200107483398151915260001b6200042f60201b6200022e1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002a9816200043260201b620002b81760201c565b6200030d5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840162000240565b80620002727f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6200042f60201b6200022e1760201c565b60606001600160a01b0384163b620003b15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000240565b600080856001600160a01b031685604051620003ce9190620005f0565b600060405180830381855af49150503d80600081146200040b576040519150601f19603f3d011682016040523d82523d6000602084013e62000410565b606091505b5090925090506200042382828662000441565b925050505b9392505050565b90565b6001600160a01b03163b151590565b606083156200045257508162000428565b825115620004635782518084602001fd5b8160405162461bcd60e51b81526004016200024091906200060e565b80516001600160a01b03811681146200049757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004cf578181015183820152602001620004b5565b50506000910152565b600080600060608486031215620004ee57600080fd5b620004f9846200047f565b925062000509602085016200047f565b60408501519092506001600160401b03808211156200052757600080fd5b818601915086601f8301126200053c57600080fd5b8151818111156200055157620005516200049c565b604051601f8201601f19908116603f011681019083821181831017156200057c576200057c6200049c565b816040528281528960208487010111156200059657600080fd5b620005a9836020830160208801620004b2565b80955050505050509250925092565b818103818111156200019f57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b6000825162000604818460208701620004b2565b9190910192915050565b60208152600082518060208401526200062f816040850160208701620004b2565b601f01601f19169190910160400192915050565b610a2180620006536000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b610090366004610895565b610135565b61006b6100a33660046108b0565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b610101366004610895565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109c5602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b60006102216105cd565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b610422836105f5565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161017481610642565b606073ffffffffffffffffffffffffffffffffffffffff84163b61054b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016103a2565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105739190610957565b600060405180830381855af49150503d80600081146105ae576040519150601f19603f3d011682016040523d82523d6000602084013e6105b3565b606091505b50915091506105c382828661074e565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b6105fe816107a1565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff81166106e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561075d5750816102b1565b82511561076d5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610973565b73ffffffffffffffffffffffffffffffffffffffff81163b610845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610708565b803573ffffffffffffffffffffffffffffffffffffffff8116811461089057600080fd5b919050565b6000602082840312156108a757600080fd5b6102b18261086c565b6000806000604084860312156108c557600080fd5b6108ce8461086c565b9250602084013567ffffffffffffffff808211156108eb57600080fd5b818601915086601f8301126108ff57600080fd5b81358181111561090e57600080fd5b87602082850101111561092057600080fd5b6020830194508093505050509250925092565b60005b8381101561094e578181015183820152602001610936565b50506000910152565b60008251610969818460208701610933565b9190910192915050565b6020815260008251806020840152610992816040850160208701610933565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122051812c356928ef88014789eaeb04ce9454e2ec8e03025a1ceedcece2f91bca8964736f6c63430008110033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b610090366004610895565b610135565b61006b6100a33660046108b0565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b610101366004610895565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109c5602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b60006102216105cd565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b610422836105f5565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161017481610642565b606073ffffffffffffffffffffffffffffffffffffffff84163b61054b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016103a2565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105739190610957565b600060405180830381855af49150503d80600081146105ae576040519150601f19603f3d011682016040523d82523d6000602084013e6105b3565b606091505b50915091506105c382828661074e565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b6105fe816107a1565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff81166106e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561075d5750816102b1565b82511561076d5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610973565b73ffffffffffffffffffffffffffffffffffffffff81163b610845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610708565b803573ffffffffffffffffffffffffffffffffffffffff8116811461089057600080fd5b919050565b6000602082840312156108a757600080fd5b6102b18261086c565b6000806000604084860312156108c557600080fd5b6108ce8461086c565b9250602084013567ffffffffffffffff808211156108eb57600080fd5b818601915086601f8301126108ff57600080fd5b81358181111561090e57600080fd5b87602082850101111561092057600080fd5b6020830194508093505050509250925092565b60005b8381101561094e578181015183820152602001610936565b50506000910152565b60008251610969818460208701610933565b9190910192915050565b6020815260008251806020840152610992816040850160208701610933565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122051812c356928ef88014789eaeb04ce9454e2ec8e03025a1ceedcece2f91bca8964736f6c63430008110033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin `TransparentUpgradeableProxy` To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/linea/AngleRouterLineaV3.json b/deployments/linea/AngleRouterLineaV3.json new file mode 100644 index 0000000..aa4219c --- /dev/null +++ b/deployments/linea/AngleRouterLineaV3.json @@ -0,0 +1,247 @@ +{ + "address": "0x1ECE8C666f104803f77c31D2a0A83264E22734B4", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_logic", + "type": "address" + }, + { + "internalType": "address", + "name": "admin_", + "type": "address" + }, + { + "internalType": "bytes", + "name": "_data", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "stateMutability": "payable", + "type": "fallback" + }, + { + "inputs": [], + "name": "admin", + "outputs": [ + { + "internalType": "address", + "name": "admin_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "changeAdmin", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "implementation", + "outputs": [ + { + "internalType": "address", + "name": "implementation_", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x7a6c0fc47b71829a58406b48599036750dec9e6feb91e6c30d73a44846ede3b3", + "receipt": { + "to": null, + "from": "0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185", + "contractAddress": "0x1ECE8C666f104803f77c31D2a0A83264E22734B4", + "transactionIndex": 8, + "gasUsed": "718546", + "logsBloom": "0x00000000000000000200000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000010000000002000000000000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000000080000000000000800000000000000000000000000000020400000000000000000000000000000000000000000020000000000800000000040000000000000400000000000000000000000000000000000000000000000000000000000000000000000001000000000000", + "blockHash": "0x3bd9825422bb2998cbc50a4bfe50d125cf704863b6daf57e18edf915fe47d90d", + "transactionHash": "0x7a6c0fc47b71829a58406b48599036750dec9e6feb91e6c30d73a44846ede3b3", + "logs": [ + { + "transactionIndex": 8, + "blockNumber": 6959469, + "transactionHash": "0x7a6c0fc47b71829a58406b48599036750dec9e6feb91e6c30d73a44846ede3b3", + "address": "0x1ECE8C666f104803f77c31D2a0A83264E22734B4", + "topics": [ + "0xbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b", + "0x0000000000000000000000009a33e690aa78a4c346e72f7a5e16e5d7278be835" + ], + "data": "0x", + "logIndex": 12, + "blockHash": "0x3bd9825422bb2998cbc50a4bfe50d125cf704863b6daf57e18edf915fe47d90d" + }, + { + "transactionIndex": 8, + "blockNumber": 6959469, + "transactionHash": "0x7a6c0fc47b71829a58406b48599036750dec9e6feb91e6c30d73a44846ede3b3", + "address": "0x1ECE8C666f104803f77c31D2a0A83264E22734B4", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 13, + "blockHash": "0x3bd9825422bb2998cbc50a4bfe50d125cf704863b6daf57e18edf915fe47d90d" + }, + { + "transactionIndex": 8, + "blockNumber": 6959469, + "transactionHash": "0x7a6c0fc47b71829a58406b48599036750dec9e6feb91e6c30d73a44846ede3b3", + "address": "0x1ECE8C666f104803f77c31D2a0A83264E22734B4", + "topics": [ + "0x7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000007475b60d88b02663d6f975927b70bb4335e4b3", + "logIndex": 14, + "blockHash": "0x3bd9825422bb2998cbc50a4bfe50d125cf704863b6daf57e18edf915fe47d90d" + } + ], + "blockNumber": 6959469, + "cumulativeGasUsed": "1427949", + "status": 1, + "byzantium": true + }, + "args": [ + "0x9A33e690AA78A4c346e72f7A5e16e5d7278BE835", + "0x007475B60d88B02663D6f975927b70BB4335e4b3", + "0x42860d4b0000000000000000000000004b1e2c2762667331bc91648052f646d1b0d3598400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000" + ], + "numDeployments": 2, + "solcInputHash": "2560f9a5795a08bc300fefd5eee2c52b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_logic\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"_data\",\"type\":\"bytes\"}],\"stateMutability\":\"payable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"previousAdmin\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"AdminChanged\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"beacon\",\"type\":\"address\"}],\"name\":\"BeaconUpgraded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"internalType\":\"address\",\"name\":\"implementation\",\"type\":\"address\"}],\"name\":\"Upgraded\",\"type\":\"event\"},{\"stateMutability\":\"payable\",\"type\":\"fallback\"},{\"inputs\":[],\"name\":\"admin\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"admin_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newAdmin\",\"type\":\"address\"}],\"name\":\"changeAdmin\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"implementation\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"implementation_\",\"type\":\"address\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"}],\"name\":\"upgradeTo\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"newImplementation\",\"type\":\"address\"},{\"internalType\":\"bytes\",\"name\":\"data\",\"type\":\"bytes\"}],\"name\":\"upgradeToAndCall\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"details\":\"This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin `TransparentUpgradeableProxy` To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \\\"admin cannot fallback to proxy target\\\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\",\"kind\":\"dev\",\"methods\":{\"admin()\":{\"details\":\"Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\"},\"changeAdmin(address)\":{\"details\":\"Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\"},\"constructor\":{\"details\":\"Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\"},\"implementation()\":{\"details\":\"Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\"},\"upgradeTo(address)\":{\"details\":\"Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\"},\"upgradeToAndCall(address,bytes)\":{\"details\":\"Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\"}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/external/TransparentUpgradeableProxy.sol\":\"TransparentUpgradeableProxy\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts/interfaces/draft-IERC1822.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\\n * proxy whose upgrades are fully controlled by the current implementation.\\n */\\ninterface IERC1822Proxiable {\\n /**\\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\\n * address.\\n *\\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\\n * function revert if invoked through a proxy.\\n */\\n function proxiableUUID() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0x1d4afe6cb24200cc4545eed814ecf5847277dfe5d613a1707aad5fceecebcfff\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../Proxy.sol\\\";\\nimport \\\"./ERC1967Upgrade.sol\\\";\\n\\n/**\\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\\n * implementation address that can be changed. This address is stored in storage in the location specified by\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\\n * implementation behind the proxy.\\n */\\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\\n /**\\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\\n *\\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\\n */\\n constructor(address _logic, bytes memory _data) payable {\\n _upgradeToAndCall(_logic, _data, false);\\n }\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _implementation() internal view virtual override returns (address impl) {\\n return ERC1967Upgrade._getImplementation();\\n }\\n}\\n\",\"keccak256\":\"0xa2b22da3032e50b55f95ec1d13336102d675f341167aa76db571ef7f8bb7975d\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../beacon/IBeacon.sol\\\";\\nimport \\\"../../interfaces/draft-IERC1822.sol\\\";\\nimport \\\"../../utils/Address.sol\\\";\\nimport \\\"../../utils/StorageSlot.sol\\\";\\n\\n/**\\n * @dev This abstract contract provides getters and event emitting update functions for\\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\\n *\\n * _Available since v4.1._\\n *\\n * @custom:oz-upgrades-unsafe-allow delegatecall\\n */\\nabstract contract ERC1967Upgrade {\\n // This is the keccak-256 hash of \\\"eip1967.proxy.rollback\\\" subtracted by 1\\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\\n\\n /**\\n * @dev Storage slot with the address of the current implementation.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.implementation\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n\\n /**\\n * @dev Emitted when the implementation is upgraded.\\n */\\n event Upgraded(address indexed implementation);\\n\\n /**\\n * @dev Returns the current implementation address.\\n */\\n function _getImplementation() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 implementation slot.\\n */\\n function _setImplementation(address newImplementation) private {\\n require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n }\\n\\n /**\\n * @dev Perform implementation upgrade\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeTo(address newImplementation) internal {\\n _setImplementation(newImplementation);\\n emit Upgraded(newImplementation);\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCall(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _upgradeTo(newImplementation);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(newImplementation, data);\\n }\\n }\\n\\n /**\\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\\n *\\n * Emits an {Upgraded} event.\\n */\\n function _upgradeToAndCallUUPS(\\n address newImplementation,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n // Upgrades from old implementations will perform a rollback test. This test requires the new\\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\\n // this special case will break upgrade paths from old UUPS implementation to new ones.\\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\\n _setImplementation(newImplementation);\\n } else {\\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\\n require(slot == _IMPLEMENTATION_SLOT, \\\"ERC1967Upgrade: unsupported proxiableUUID\\\");\\n } catch {\\n revert(\\\"ERC1967Upgrade: new implementation is not UUPS\\\");\\n }\\n _upgradeToAndCall(newImplementation, data, forceCall);\\n }\\n }\\n\\n /**\\n * @dev Storage slot with the admin of the contract.\\n * This is the keccak-256 hash of \\\"eip1967.proxy.admin\\\" subtracted by 1, and is\\n * validated in the constructor.\\n */\\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\\n\\n /**\\n * @dev Emitted when the admin account has changed.\\n */\\n event AdminChanged(address previousAdmin, address newAdmin);\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _getAdmin() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new address in the EIP1967 admin slot.\\n */\\n function _setAdmin(address newAdmin) private {\\n require(newAdmin != address(0), \\\"ERC1967: new admin is the zero address\\\");\\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n */\\n function _changeAdmin(address newAdmin) internal {\\n emit AdminChanged(_getAdmin(), newAdmin);\\n _setAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\\n */\\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\\n\\n /**\\n * @dev Emitted when the beacon is upgraded.\\n */\\n event BeaconUpgraded(address indexed beacon);\\n\\n /**\\n * @dev Returns the current beacon.\\n */\\n function _getBeacon() internal view returns (address) {\\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\\n }\\n\\n /**\\n * @dev Stores a new beacon in the EIP1967 beacon slot.\\n */\\n function _setBeacon(address newBeacon) private {\\n require(Address.isContract(newBeacon), \\\"ERC1967: new beacon is not a contract\\\");\\n require(\\n Address.isContract(IBeacon(newBeacon).implementation()),\\n \\\"ERC1967: beacon implementation is not a contract\\\"\\n );\\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\\n }\\n\\n /**\\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\\n *\\n * Emits a {BeaconUpgraded} event.\\n */\\n function _upgradeBeaconToAndCall(\\n address newBeacon,\\n bytes memory data,\\n bool forceCall\\n ) internal {\\n _setBeacon(newBeacon);\\n emit BeaconUpgraded(newBeacon);\\n if (data.length > 0 || forceCall) {\\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\\n }\\n }\\n}\\n\",\"keccak256\":\"0xabf3f59bc0e5423eae45e459dbe92e7052c6983628d39008590edc852a62f94a\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/Proxy.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\\n * be specified by overriding the virtual {_implementation} function.\\n *\\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\\n * different contract through the {_delegate} function.\\n *\\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\\n */\\nabstract contract Proxy {\\n /**\\n * @dev Delegates the current call to `implementation`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _delegate(address implementation) internal virtual {\\n assembly {\\n // Copy msg.data. We take full control of memory in this inline assembly\\n // block because it will not return to Solidity code. We overwrite the\\n // Solidity scratch pad at memory position 0.\\n calldatacopy(0, 0, calldatasize())\\n\\n // Call the implementation.\\n // out and outsize are 0 because we don't know the size yet.\\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\\n\\n // Copy the returned data.\\n returndatacopy(0, 0, returndatasize())\\n\\n switch result\\n // delegatecall returns 0 on error.\\n case 0 {\\n revert(0, returndatasize())\\n }\\n default {\\n return(0, returndatasize())\\n }\\n }\\n }\\n\\n /**\\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\\n * and {_fallback} should delegate.\\n */\\n function _implementation() internal view virtual returns (address);\\n\\n /**\\n * @dev Delegates the current call to the address returned by `_implementation()`.\\n *\\n * This function does not return to its internal call site, it will return directly to the external caller.\\n */\\n function _fallback() internal virtual {\\n _beforeFallback();\\n _delegate(_implementation());\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\\n * function in the contract matches the call data.\\n */\\n fallback() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\\n * is empty.\\n */\\n receive() external payable virtual {\\n _fallback();\\n }\\n\\n /**\\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\\n * call, or as part of the Solidity `fallback` or `receive` functions.\\n *\\n * If overridden should call `super._beforeFallback()`.\\n */\\n function _beforeFallback() internal virtual {}\\n}\\n\",\"keccak256\":\"0xc130fe33f1b2132158531a87734153293f6d07bc263ff4ac90e85da9c82c0e27\",\"license\":\"MIT\"},\"@openzeppelin/contracts/proxy/beacon/IBeacon.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\\n */\\ninterface IBeacon {\\n /**\\n * @dev Must return an address that can be used as a delegate call target.\\n *\\n * {BeaconProxy} will check that this address is a contract.\\n */\\n function implementation() external view returns (address);\\n}\\n\",\"keccak256\":\"0xd50a3421ac379ccb1be435fa646d66a65c986b4924f0849839f08692f39dde61\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/StorageSlot.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Library for reading and writing primitive types to specific storage slots.\\n *\\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\\n * This library helps with reading and writing to such slots without the need for inline assembly.\\n *\\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\\n *\\n * Example usage to set ERC1967 implementation slot:\\n * ```\\n * contract ERC1967 {\\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\\n *\\n * function _getImplementation() internal view returns (address) {\\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\\n * }\\n *\\n * function _setImplementation(address newImplementation) internal {\\n * require(Address.isContract(newImplementation), \\\"ERC1967: new implementation is not a contract\\\");\\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\\n * }\\n * }\\n * ```\\n *\\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\\n */\\nlibrary StorageSlot {\\n struct AddressSlot {\\n address value;\\n }\\n\\n struct BooleanSlot {\\n bool value;\\n }\\n\\n struct Bytes32Slot {\\n bytes32 value;\\n }\\n\\n struct Uint256Slot {\\n uint256 value;\\n }\\n\\n /**\\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\\n */\\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\\n */\\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\\n */\\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n\\n /**\\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\\n */\\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\\n /// @solidity memory-safe-assembly\\n assembly {\\n r.slot := slot\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd5c50c54bf02740ebd122ff06832546cb5fa84486d52695a9ccfd11666e0c81d\",\"license\":\"MIT\"},\"contracts/external/TransparentUpgradeableProxy.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\\\";\\n\\n/**\\n * @dev This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin\\n * `TransparentUpgradeableProxy`\\n *\\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\\n * clashing], which can potentially be used in an attack, this contract uses the\\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\\n * things that go hand in hand:\\n *\\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\\n * that call matches one of the admin functions exposed by the proxy itself.\\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\\n * \\\"admin cannot fallback to proxy target\\\".\\n *\\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\\n * to sudden errors when trying to call a function from the proxy implementation.\\n *\\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\\n */\\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\\n /**\\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\\n */\\n constructor(\\n address _logic,\\n address admin_,\\n bytes memory _data\\n ) payable ERC1967Proxy(_logic, _data) {\\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\\\"eip1967.proxy.admin\\\")) - 1));\\n _changeAdmin(admin_);\\n }\\n\\n /**\\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\\n */\\n modifier ifAdmin() {\\n if (msg.sender == _getAdmin()) {\\n _;\\n } else {\\n _fallback();\\n }\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\\n */\\n function admin() external ifAdmin returns (address admin_) {\\n admin_ = _getAdmin();\\n }\\n\\n /**\\n * @dev Returns the current implementation.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\\n *\\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\\n */\\n function implementation() external ifAdmin returns (address implementation_) {\\n implementation_ = _implementation();\\n }\\n\\n /**\\n * @dev Changes the admin of the proxy.\\n *\\n * Emits an {AdminChanged} event.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\\n */\\n function changeAdmin(address newAdmin) external virtual ifAdmin {\\n _changeAdmin(newAdmin);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\\n */\\n function upgradeTo(address newImplementation) external ifAdmin {\\n _upgradeToAndCall(newImplementation, bytes(\\\"\\\"), false);\\n }\\n\\n /**\\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\\n * proxied contract.\\n *\\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\\n */\\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\\n _upgradeToAndCall(newImplementation, data, true);\\n }\\n\\n /**\\n * @dev Returns the current admin.\\n */\\n function _admin() internal view virtual returns (address) {\\n return _getAdmin();\\n }\\n\\n /**\\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\\n */\\n function _beforeFallback() internal virtual override {\\n require(msg.sender != _getAdmin(), \\\"TransparentUpgradeableProxy: admin cannot fallback to proxy target\\\");\\n super._beforeFallback();\\n }\\n}\\n\",\"keccak256\":\"0xdbb2775fbc740793c0b3d5927cca8b9976cc4f9caef50178d1be0aa7afca14e6\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x6080604052604051620010bb380380620010bb8339810160408190526200002691620004d8565b828162000036828260006200009a565b5062000066905060017fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6104620005b8565b6000805160206200107483398151915214620000865762000086620005da565b6200009182620000d7565b50505062000643565b620000a58362000132565b600082511180620000b35750805b15620000d257620000d083836200017460201b6200028c1760201c565b505b505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f62000102620001a5565b604080516001600160a01b03928316815291841660208301520160405180910390a16200012f81620001de565b50565b6200013d8162000293565b6040516001600160a01b038216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b60606200019c8383604051806060016040528060278152602001620010946027913962000347565b90505b92915050565b6000620001cf6000805160206200107483398151915260001b6200042f60201b6200022e1760201c565b546001600160a01b0316919050565b6001600160a01b038116620002495760405162461bcd60e51b815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201526564647265737360d01b60648201526084015b60405180910390fd5b80620002726000805160206200107483398151915260001b6200042f60201b6200022e1760201c565b80546001600160a01b0319166001600160a01b039290921691909117905550565b620002a9816200043260201b620002b81760201c565b6200030d5760405162461bcd60e51b815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201526c1bdd08184818dbdb9d1c9858dd609a1b606482015260840162000240565b80620002727f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc60001b6200042f60201b6200022e1760201c565b60606001600160a01b0384163b620003b15760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f6044820152651b9d1c9858dd60d21b606482015260840162000240565b600080856001600160a01b031685604051620003ce9190620005f0565b600060405180830381855af49150503d80600081146200040b576040519150601f19603f3d011682016040523d82523d6000602084013e62000410565b606091505b5090925090506200042382828662000441565b925050505b9392505050565b90565b6001600160a01b03163b151590565b606083156200045257508162000428565b825115620004635782518084602001fd5b8160405162461bcd60e51b81526004016200024091906200060e565b80516001600160a01b03811681146200049757600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b83811015620004cf578181015183820152602001620004b5565b50506000910152565b600080600060608486031215620004ee57600080fd5b620004f9846200047f565b925062000509602085016200047f565b60408501519092506001600160401b03808211156200052757600080fd5b818601915086601f8301126200053c57600080fd5b8151818111156200055157620005516200049c565b604051601f8201601f19908116603f011681019083821181831017156200057c576200057c6200049c565b816040528281528960208487010111156200059657600080fd5b620005a9836020830160208801620004b2565b80955050505050509250925092565b818103818111156200019f57634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052600160045260246000fd5b6000825162000604818460208701620004b2565b9190910192915050565b60208152600082518060208401526200062f816040850160208701620004b2565b601f01601f19169190910160400192915050565b610a2180620006536000396000f3fe60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b610090366004610895565b610135565b61006b6100a33660046108b0565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b610101366004610895565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109c5602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b60006102216105cd565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b610422836105f5565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161017481610642565b606073ffffffffffffffffffffffffffffffffffffffff84163b61054b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016103a2565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105739190610957565b600060405180830381855af49150503d80600081146105ae576040519150601f19603f3d011682016040523d82523d6000602084013e6105b3565b606091505b50915091506105c382828661074e565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b6105fe816107a1565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff81166106e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561075d5750816102b1565b82511561076d5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610973565b73ffffffffffffffffffffffffffffffffffffffff81163b610845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610708565b803573ffffffffffffffffffffffffffffffffffffffff8116811461089057600080fd5b919050565b6000602082840312156108a757600080fd5b6102b18261086c565b6000806000604084860312156108c557600080fd5b6108ce8461086c565b9250602084013567ffffffffffffffff808211156108eb57600080fd5b818601915086601f8301126108ff57600080fd5b81358181111561090e57600080fd5b87602082850101111561092057600080fd5b6020830194508093505050509250925092565b60005b8381101561094e578181015183820152602001610936565b50506000910152565b60008251610969818460208701610933565b9190910192915050565b6020815260008251806020840152610992816040850160208701610933565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122051812c356928ef88014789eaeb04ce9454e2ec8e03025a1ceedcece2f91bca8964736f6c63430008110033b53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564", + "deployedBytecode": "0x60806040526004361061005e5760003560e01c80635c60da1b116100435780635c60da1b146100a85780638f283970146100e6578063f851a440146101065761006d565b80633659cfe6146100755780634f1ef286146100955761006d565b3661006d5761006b61011b565b005b61006b61011b565b34801561008157600080fd5b5061006b610090366004610895565b610135565b61006b6100a33660046108b0565b61017f565b3480156100b457600080fd5b506100bd6101f3565b60405173ffffffffffffffffffffffffffffffffffffffff909116815260200160405180910390f35b3480156100f257600080fd5b5061006b610101366004610895565b610231565b34801561011257600080fd5b506100bd61025e565b6101236102d4565b61013361012e6103ab565b6103b5565b565b61013d6103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481604051806020016040528060008152506000610419565b50565b61017461011b565b6101876103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101eb576101e68383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525060019250610419915050565b505050565b6101e661011b565b60006101fd6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103ab565b905090565b61022e61011b565b90565b6102396103d9565b73ffffffffffffffffffffffffffffffffffffffff1633036101775761017481610444565b60006102686103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610226576102216103d9565b60606102b183836040518060600160405280602781526020016109c5602791396104a5565b9392505050565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b6102dc6103d9565b73ffffffffffffffffffffffffffffffffffffffff163303610133576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152604260248201527f5472616e73706172656e745570677261646561626c6550726f78793a2061646d60448201527f696e2063616e6e6f742066616c6c6261636b20746f2070726f7879207461726760648201527f6574000000000000000000000000000000000000000000000000000000000000608482015260a4015b60405180910390fd5b60006102216105cd565b3660008037600080366000845af43d6000803e8080156103d4573d6000f35b3d6000fd5b60007fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b5473ffffffffffffffffffffffffffffffffffffffff16919050565b610422836105f5565b60008251118061042f5750805b156101e65761043e838361028c565b50505050565b7f7e644d79422f17c01e4894b5f4f588d331ebfa28653d42ae832dc59e38c9798f61046d6103d9565b6040805173ffffffffffffffffffffffffffffffffffffffff928316815291841660208301520160405180910390a161017481610642565b606073ffffffffffffffffffffffffffffffffffffffff84163b61054b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016103a2565b6000808573ffffffffffffffffffffffffffffffffffffffff16856040516105739190610957565b600060405180830381855af49150503d80600081146105ae576040519150601f19603f3d011682016040523d82523d6000602084013e6105b3565b606091505b50915091506105c382828661074e565b9695505050505050565b60007f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc6103fd565b6105fe816107a1565b60405173ffffffffffffffffffffffffffffffffffffffff8216907fbc7cd75a20ee27fd9adebab32041f755214dbc6bffa90cc0225b39da2e5c2d3b90600090a250565b73ffffffffffffffffffffffffffffffffffffffff81166106e5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f455243313936373a206e65772061646d696e20697320746865207a65726f206160448201527f646472657373000000000000000000000000000000000000000000000000000060648201526084016103a2565b807fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035b80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff9290921691909117905550565b6060831561075d5750816102b1565b82511561076d5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103a29190610973565b73ffffffffffffffffffffffffffffffffffffffff81163b610845576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602d60248201527f455243313936373a206e657720696d706c656d656e746174696f6e206973206e60448201527f6f74206120636f6e74726163740000000000000000000000000000000000000060648201526084016103a2565b807f360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc610708565b803573ffffffffffffffffffffffffffffffffffffffff8116811461089057600080fd5b919050565b6000602082840312156108a757600080fd5b6102b18261086c565b6000806000604084860312156108c557600080fd5b6108ce8461086c565b9250602084013567ffffffffffffffff808211156108eb57600080fd5b818601915086601f8301126108ff57600080fd5b81358181111561090e57600080fd5b87602082850101111561092057600080fd5b6020830194508093505050509250925092565b60005b8381101561094e578181015183820152602001610936565b50506000910152565b60008251610969818460208701610933565b9190910192915050565b6020815260008251806020840152610992816040850160208701610933565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016919091016040019291505056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a264697066735822122051812c356928ef88014789eaeb04ce9454e2ec8e03025a1ceedcece2f91bca8964736f6c63430008110033", + "devdoc": { + "details": "This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin `TransparentUpgradeableProxy` To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector clashing], which can potentially be used in an attack, this contract uses the https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two things that go hand in hand: 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if that call matches one of the admin functions exposed by the proxy itself. 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the implementation. If the admin tries to call a function on the implementation it will fail with an error that says \"admin cannot fallback to proxy target\". These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due to sudden errors when trying to call a function from the proxy implementation. Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way, you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.", + "kind": "dev", + "methods": { + "admin()": { + "details": "Returns the current admin. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`" + }, + "changeAdmin(address)": { + "details": "Changes the admin of the proxy. Emits an {AdminChanged} event. NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}." + }, + "constructor": { + "details": "Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}." + }, + "implementation()": { + "details": "Returns the current implementation. NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}. TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call. `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`" + }, + "upgradeTo(address)": { + "details": "Upgrade the implementation of the proxy. NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}." + }, + "upgradeToAndCall(address,bytes)": { + "details": "Upgrade the implementation of the proxy, and then call a function from the new implementation as specified by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the proxied contract. NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}." + } + }, + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": {}, + "version": 1 + }, + "storageLayout": { + "storage": [], + "types": null + } +} \ No newline at end of file diff --git a/deployments/linea/AngleRouterLineaV3_0_Implementation.json b/deployments/linea/AngleRouterLineaV3_0_Implementation.json new file mode 100644 index 0000000..a0786a7 --- /dev/null +++ b/deployments/linea/AngleRouterLineaV3_0_Implementation.json @@ -0,0 +1,618 @@ +{ + "address": "0x9A33e690AA78A4c346e72f7A5e16e5d7278BE835", + "abi": [ + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReturnMessage", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferredDeposit", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "spenders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "changeAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit4626Referral", + "outputs": [ + { + "internalType": "uint256", + "name": "sharesOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_uniswapRouter", + "type": "address" + }, + { + "internalType": "address", + "name": "_oneInch", + "type": "address" + } + ], + "name": "initializeRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vaultManager", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitVaultManagerType[]", + "name": "paramsPermitVaultManager", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixerVaultManagerPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "oneInch", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "_core", + "type": "address" + } + ], + "name": "setCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "internalType": "uint8", + "name": "who", + "type": "uint8" + } + ], + "name": "setRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "uniswapV3Router", + "outputs": [ + { + "internalType": "contract IUniswapV3Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xf133427f2a3547faf6c1087acfbc20ad994093742cd3ef9d1e48dd569b9d80c2", + "receipt": { + "to": null, + "from": "0xfdA462548Ce04282f4B6D6619823a7C64Fdc0185", + "contractAddress": "0x9A33e690AA78A4c346e72f7A5e16e5d7278BE835", + "transactionIndex": 10, + "gasUsed": "3563854", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000010000040000000000000000000000000", + "blockHash": "0xe3d5aae94ea725d7953b481c8736fdcc7d052038b1f1974c769b8f4ef077b379", + "transactionHash": "0xf133427f2a3547faf6c1087acfbc20ad994093742cd3ef9d1e48dd569b9d80c2", + "logs": [ + { + "transactionIndex": 10, + "blockNumber": 6959287, + "transactionHash": "0xf133427f2a3547faf6c1087acfbc20ad994093742cd3ef9d1e48dd569b9d80c2", + "address": "0x9A33e690AA78A4c346e72f7A5e16e5d7278BE835", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 16, + "blockHash": "0xe3d5aae94ea725d7953b481c8736fdcc7d052038b1f1974c769b8f4ef077b379" + } + ], + "blockNumber": 6959287, + "cumulativeGasUsed": "4475849", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "2560f9a5795a08bc300fefd5eee2c52b", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReturnMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApprovedOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferredDeposit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"spenders\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"changeAllowance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minSharesOut\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"deposit4626Referral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sharesOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_uniswapRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oneInch\",\"type\":\"address\"}],\"name\":\"initializeRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"vaultManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitVaultManagerType[]\",\"name\":\"paramsPermitVaultManager\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixerVaultManagerPermit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oneInch\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"setCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"who\",\"type\":\"uint8\"}],\"name\":\"setRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV3Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Router\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"params\":{\"amounts\":\"Amounts to allow\",\"spenders\":\"Addresses to allow transfer\",\"tokens\":\"Addresses of the tokens to allow\"}},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens\",\"params\":{\"actions\":\"List of actions to be performed by the router (in order of execution)\",\"data\":\"Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored\",\"paramsPermit\":\"Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\"}},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option\",\"params\":{\"paramsPermitVaultManager\":\"Parameters to sign permit to give allowance to the router for a `VaultManager` contract\"}}},\"title\":\"AngleRouterLinea\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"notice\":\"Changes allowances for different tokens\"},\"core()\":{\"notice\":\"Core address handling access control\"},\"deposit4626Referral(address,address,uint256,address,uint256,address)\":{\"notice\":\"Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract\"},\"initializeRouter(address,address,address)\":{\"notice\":\"Deploys the router contract on a chain\"},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Allows composable calls to different functions within the protocol\"},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions\"},\"oneInch()\":{\"notice\":\"Address of 1Inch router used for swaps\"},\"setCore(address)\":{\"notice\":\"Sets a new `core` contract\"},\"setRouter(address,uint8)\":{\"notice\":\"Sets a new router variable\"},\"uniswapV3Router()\":{\"notice\":\"Address of the router used for swaps\"}},\"notice\":\"Router contract built specifially for Angle use cases on Linea\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/implementations/linea/AngleRouterLinea.sol\":\"AngleRouterLinea\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x9750c6fec736eb3320e85924f36a3060fa4a4ab1758d06d9585e175d164eefdb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\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 IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\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 require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\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 */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\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. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"contracts/BaseRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport \\\"./interfaces/external/uniswap/IUniswapRouter.sol\\\";\\nimport \\\"./interfaces/external/IWETH9.sol\\\";\\nimport \\\"./interfaces/ICoreBorrow.sol\\\";\\nimport \\\"./interfaces/IDepositWithReferral.sol\\\";\\nimport \\\"./interfaces/ILiquidityGauge.sol\\\";\\nimport \\\"./interfaces/ISwapper.sol\\\";\\nimport \\\"./interfaces/IVaultManager.sol\\\";\\n\\n// ============================== STRUCTS AND ENUM =============================\\n\\n/// @notice Action types\\nenum ActionType {\\n transfer,\\n wrapNative,\\n unwrapNative,\\n sweep,\\n sweepNative,\\n // Deprecated\\n uniswapV3,\\n oneInch,\\n claimRewards,\\n // Deprecated\\n gaugeDeposit,\\n borrower,\\n swapper,\\n mint4626,\\n deposit4626,\\n redeem4626,\\n withdraw4626,\\n // Deprecated\\n prepareRedeemSavingsRate,\\n // Deprecated\\n claimRedeemSavingsRate,\\n // Deprecated\\n swapIn,\\n // Deprecated\\n swapOut,\\n claimWeeklyInterest,\\n // Deprecated\\n withdraw,\\n // Deprecated\\n mint,\\n // Deprecated\\n deposit,\\n // Deprecated\\n openPerpetual,\\n // Deprecated\\n addToPerpetual,\\n veANGLEDeposit,\\n // Deprecated\\n claimRewardsWithPerps,\\n deposit4626Referral\\n}\\n\\n/// @notice Data needed to get permits\\nstruct PermitType {\\n address token;\\n address owner;\\n uint256 value;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @notice Data to grant permit to the router for a vault\\nstruct PermitVaultManagerType {\\n address vaultManager;\\n address owner;\\n bool approved;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @title BaseRouter\\n/// @author Angle Core Team\\n/// @notice Base contract that Angle router contracts on different chains should override\\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\\n using SafeERC20 for IERC20;\\n\\n // ================================= REFERENCES ================================\\n\\n /// @notice Core address handling access control\\n ICoreBorrow public core;\\n /// @notice Address of the router used for swaps\\n IUniswapV3Router public uniswapV3Router;\\n /// @notice Address of 1Inch router used for swaps\\n address public oneInch;\\n\\n uint256[47] private __gap;\\n\\n // ============================== EVENTS / ERRORS ==============================\\n\\n error IncompatibleLengths();\\n error InvalidReturnMessage();\\n error NotApprovedOrOwner();\\n error NotGovernor();\\n error NotGovernorOrGuardian();\\n error TooSmallAmountOut();\\n error TransferFailed();\\n error ZeroAddress();\\n\\n event ReferredDeposit(\\n address caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares,\\n address indexed savings,\\n address indexed referrer\\n );\\n\\n /// @notice Deploys the router contract on a chain\\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\\n if (_core == address(0)) revert ZeroAddress();\\n core = ICoreBorrow(_core);\\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\\n oneInch = _oneInch;\\n }\\n\\n constructor() initializer {}\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @notice Allows composable calls to different functions within the protocol\\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\\n /// @param actions List of actions to be performed by the router (in order of execution)\\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\\n /// for a given action are stored\\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\\n /// do not perform a sweep action on these tokens\\n function mixer(\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) public payable virtual {\\n // If all tokens have already been approved, there's no need for this step\\n uint256 permitsLength = paramsPermit.length;\\n for (uint256 i; i < permitsLength; ++i) {\\n IERC20Permit(paramsPermit[i].token).permit(\\n paramsPermit[i].owner,\\n address(this),\\n paramsPermit[i].value,\\n paramsPermit[i].deadline,\\n paramsPermit[i].v,\\n paramsPermit[i].r,\\n paramsPermit[i].s\\n );\\n }\\n // Performing actions one after the others\\n uint256 actionsLength = actions.length;\\n for (uint256 i; i < actionsLength; ++i) {\\n if (actions[i] == ActionType.transfer) {\\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\\n } else if (actions[i] == ActionType.wrapNative) {\\n _wrapNative();\\n } else if (actions[i] == ActionType.unwrapNative) {\\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\\n _unwrapNative(minAmountOut, to);\\n } else if (actions[i] == ActionType.sweep) {\\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\\n _sweep(tokenOut, minAmountOut, to);\\n } else if (actions[i] == ActionType.sweepNative) {\\n uint256 routerBalance = address(this).balance;\\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\\n } else if (actions[i] == ActionType.oneInch) {\\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\\n data[i],\\n (address, uint256, bytes)\\n );\\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\\n } else if (actions[i] == ActionType.claimRewards) {\\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\\n _claimRewards(user, claimLiquidityGauges);\\n } else if (actions[i] == ActionType.borrower) {\\n (\\n address collateral,\\n address vaultManager,\\n address to,\\n address who,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n bytes memory repayData\\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\\n } else if (actions[i] == ActionType.swapper) {\\n (\\n ISwapper swapperContract,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory payload\\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\\n } else if (actions[i] == ActionType.mint4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _mint4626(savingsRate, shares, to, maxAmountIn);\\n } else if (actions[i] == ActionType.deposit4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626(savingsRate, amount, to, minSharesOut);\\n } else if (actions[i] == ActionType.deposit4626Referral) {\\n (\\n IERC20 token,\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\\n } else if (actions[i] == ActionType.redeem4626) {\\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _redeem4626(savingsRate, shares, to, minAmountOut);\\n } else if (actions[i] == ActionType.withdraw4626) {\\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\\n } else {\\n _chainSpecificAction(actions[i], data[i]);\\n }\\n }\\n }\\n\\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\\n /// addresses depositing from a certain referring address into an ERC4626 contract\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut) {\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n _changeAllowance(IERC20(token), savings, type(uint256).max);\\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\\n }\\n\\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\\n /// actions and then revoking this approval after these actions\\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\\n /// to revoke approvals\\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\\n /// is just an option\\n function mixerVaultManagerPermit(\\n PermitVaultManagerType[] memory paramsPermitVaultManager,\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) external payable virtual {\\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n true,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n } else break;\\n }\\n mixer(paramsPermit, actions, data);\\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\\n // too deep\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (!paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n false,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n }\\n }\\n }\\n\\n receive() external payable {}\\n\\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\\n\\n /// @notice Wraps the native token of a chain to its wrapped version\\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\\n /// @dev The amount to wrap is to be specified in the `msg.value`\\n function _wrapNative() internal virtual returns (uint256) {\\n _getNativeWrapper().deposit{ value: msg.value }();\\n return msg.value;\\n }\\n\\n /// @notice Unwraps the wrapped version of a token to the native chain token\\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\\n amount = _getNativeWrapper().balanceOf(address(this));\\n _slippageCheck(amount, minAmountOut);\\n if (amount != 0) {\\n _getNativeWrapper().withdraw(amount);\\n _safeTransferNative(to, amount);\\n }\\n return amount;\\n }\\n\\n /// @notice Internal version of the `claimRewards` function\\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\\n uint256 gaugesLength = liquidityGauges.length;\\n for (uint256 i; i < gaugesLength; ++i) {\\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\\n }\\n }\\n\\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\\n /// @param vaultManager Address of the vault to perform actions on\\n /// @param actionsBorrow Actions type to perform on the vaultManager\\n /// @param dataBorrow Data needed for each actions\\n /// @param to Address to send the funds to\\n /// @param who Swapper address to handle repayments\\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\\n function _angleBorrower(\\n address vaultManager,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address to,\\n address who,\\n bytes memory repayData\\n ) internal virtual returns (PaymentData memory paymentData) {\\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\\n }\\n\\n /// @notice Sweeps tokens from the router contract\\n /// @param tokenOut Token to sweep\\n /// @param minAmountOut Minimum amount of tokens to recover\\n /// @param to Address to which tokens should be sent\\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\\n _slippageCheck(balanceToken, minAmountOut);\\n if (balanceToken != 0) {\\n IERC20(tokenOut).safeTransfer(to, balanceToken);\\n }\\n }\\n\\n /// @notice Uses an external swapper\\n /// @param swapper Contracts implementing the logic of the swap\\n /// @param inToken Token used to do the swap\\n /// @param outToken Token wanted\\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\\n /// @param inTokenObtained Amount of `inToken` used for the swap\\n /// @param data Additional info for the specific swapper\\n function _swapper(\\n ISwapper swapper,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) internal {\\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\\n }\\n\\n /// @notice Swaps an inToken to another token via 1Inch Router\\n /// @param payload Bytes needed for 1Inch router to process the swap\\n /// @dev The `payload` given is expected to be obtained from 1Inch API\\n function _swapOn1Inch(\\n IERC20 inToken,\\n uint256 minAmountOut,\\n bytes memory payload\\n ) internal returns (uint256 amountOut) {\\n // Approve transfer to the `oneInch` address\\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\\n address oneInchRouter = oneInch;\\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\\n //solhint-disable-next-line\\n (bool success, bytes memory result) = oneInchRouter.call(payload);\\n if (!success) _revertBytes(result);\\n\\n amountOut = abi.decode(result, (uint256));\\n _slippageCheck(amountOut, minAmountOut);\\n }\\n\\n /// @notice Mints `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to mint shares from\\n /// @param shares Amount of shares to mint from the contract\\n /// @param to Address to which shares should be sent\\n /// @param maxAmountIn Max amount of assets used to mint\\n /// @return amountIn Amount of assets used to mint by `to`\\n function _mint4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 maxAmountIn\\n ) internal returns (uint256 amountIn) {\\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\\n }\\n\\n /// @notice Deposits `amount` to an ERC4626 contract\\n /// @param savingsRate The ERC4626 to deposit assets to\\n /// @param amount Amount of assets to deposit\\n /// @param to Address to which shares should be sent\\n /// @param minSharesOut Minimum amount of shares that `to` should received\\n /// @return sharesOut Amount of shares received by `to`\\n function _deposit4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\\n }\\n\\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\\n function _deposit4626Referral(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) internal returns (uint256 sharesOut) {\\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\\n }\\n\\n /// @notice Withdraws `amount` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to withdraw assets from\\n /// @param amount Amount of assets to withdraw\\n /// @param to Destination of assets\\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\\n /// @return sharesOut Amount of shares burnt\\n function _withdraw4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 maxSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\\n }\\n\\n /// @notice Redeems `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to redeem shares from\\n /// @param shares Amount of shares to redeem\\n /// @param to Destination of assets\\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\\n /// @return amountOut Amount of assets received by `to`\\n function _redeem4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 minAmountOut\\n ) internal returns (uint256 amountOut) {\\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\\n }\\n\\n /// @notice Allows to perform some specific actions for a chain\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\\n\\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\\n\\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\\n\\n // ============================ GOVERNANCE FUNCTION ============================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Sets a new `core` contract\\n function setCore(ICoreBorrow _core) external {\\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\\n core = ICoreBorrow(_core);\\n }\\n\\n /// @notice Changes allowances for different tokens\\n /// @param tokens Addresses of the tokens to allow\\n /// @param spenders Addresses to allow transfer\\n /// @param amounts Amounts to allow\\n function changeAllowance(\\n IERC20[] calldata tokens,\\n address[] calldata spenders,\\n uint256[] calldata amounts\\n ) external onlyGovernorOrGuardian {\\n uint256 tokensLength = tokens.length;\\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\\n for (uint256 i; i < tokensLength; ++i) {\\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\\n }\\n }\\n\\n /// @notice Sets a new router variable\\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\\n if (router == address(0)) revert ZeroAddress();\\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\\n else oneInch = router;\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Changes allowance of this contract for a given token\\n /// @param token Address of the token to change allowance\\n /// @param spender Address to change the allowance of\\n /// @param amount Amount allowed\\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\\n } else if (currentAllowance > amount) {\\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\\n }\\n }\\n\\n /// @notice Transfer amount of the native token to the `to` address\\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\\n function _safeTransferNative(address to, uint256 amount) internal {\\n bool success;\\n //solhint-disable-next-line\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n if (!success) revert TransferFailed();\\n }\\n\\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\\n /// the calling address is well approved for all the vaults with which it is interacting\\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\\n /// with a vault are approved for this vault\\n function _parseVaultIDs(\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address vaultManager,\\n address collateral\\n ) internal view returns (bytes[] memory) {\\n uint256 actionsBorrowLength = actionsBorrow.length;\\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\\n bool createVaultAction;\\n uint256 lastVaultID;\\n uint256 vaultIDLength;\\n for (uint256 i; i < actionsBorrowLength; ++i) {\\n uint256 vaultID;\\n // If there is a `createVault` action, the router should not worry about looking at\\n // next vaultIDs given equal to 0\\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\\n createVaultAction = true;\\n continue;\\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\\n // as collateral the full contract balance\\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\\n uint256 amount;\\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\\n if (amount == type(uint256).max)\\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\\n continue;\\n // There are different ways depending on the action to find the `vaultID` to parse\\n } else if (\\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\\n ) {\\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\\n vaultID = abi.decode(dataBorrow[i], (uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\\n } else continue;\\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\\n // if there has not been any specific action\\n if (vaultID == 0) {\\n if (createVaultAction) {\\n continue;\\n } else {\\n // If we haven't stored the last `vaultID`, we need to fetch it\\n if (lastVaultID == 0) {\\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\\n }\\n vaultID = lastVaultID;\\n }\\n }\\n\\n // Check if this `vaultID` has already been verified\\n for (uint256 j; j < vaultIDLength; ++j) {\\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\\n // If yes, we continue to the next iteration\\n continue;\\n }\\n }\\n // Verify this new `vaultID` and add it to the list\\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\\n revert NotApprovedOrOwner();\\n }\\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\\n vaultIDLength += 1;\\n }\\n return dataBorrow;\\n }\\n\\n /// @notice Checks whether the amount obtained during a swap is not too small\\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\\n if (amount < thresholdAmount) revert TooSmallAmountOut();\\n }\\n\\n /// @notice Internal function used for error handling\\n function _revertBytes(bytes memory errMsg) internal pure {\\n if (errMsg.length != 0) {\\n //solhint-disable-next-line\\n assembly {\\n revert(add(32, errMsg), mload(errMsg))\\n }\\n }\\n revert InvalidReturnMessage();\\n }\\n}\\n\",\"keccak256\":\"0x5b45e51240ed42ae858c34a0e7e15003885bd998d3a47da7a4fa5604b69f5c2f\",\"license\":\"GPL-3.0\"},\"contracts/implementations/linea/AngleRouterLinea.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"../../BaseRouter.sol\\\";\\n\\n/// @title AngleRouterLinea\\n/// @author Angle Core Team\\n/// @notice Router contract built specifially for Angle use cases on Linea\\ncontract AngleRouterLinea is BaseRouter {\\n /// @inheritdoc BaseRouter\\n function _getNativeWrapper() internal pure override returns (IWETH9) {\\n return IWETH9(0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f);\\n }\\n}\\n\",\"keccak256\":\"0x6172cf26d1520e01b0f7ecc2cce8c424ece9843722c0c6f2e29d87d0c4e5bdfe\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ICoreBorrow.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICoreBorrow\\n/// @author Angle Core Team\\n/// @notice Interface for the `CoreBorrow` contract\\n\\ninterface ICoreBorrow {\\n /// @notice Checks whether an address is governor of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2414539c445977b04bc7e9adac2e5147364994dd74e5d7118b44824956de602c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDepositWithReferral.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IDepositWithReferral\\n/// @author Angle Core Team\\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\\ninterface IDepositWithReferral {\\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\\n /// obtained, the function reverts\\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\\n /// when a deposit takes place\\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut);\\n}\\n\",\"keccak256\":\"0x69b88fa9ec5111394843f54f312c3b8c1b47490c76109a97ba90e4ac5697e960\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ILiquidityGauge.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface ILiquidityGauge {\\n // solhint-disable-next-line\\n function staking_token() external returns (address stakingToken);\\n\\n // solhint-disable-next-line\\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\\n\\n function deposit(\\n uint256 _value,\\n address _addr,\\n // solhint-disable-next-line\\n bool _claim_rewards\\n ) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr, address _receiver) external;\\n}\\n\",\"keccak256\":\"0x27144c21760603a4e441bb5eecf975ad7f71331ac0ba0a83352b280ccf734756\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\n/// @title ISwapper\\n/// @author Angle Core Team\\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\\ninterface ISwapper {\\n function swap(\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0x506f50d8447c2dc662bd844779cc66a407af07a91210612b956ef47abcc15776\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITreasury.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ITreasury\\n/// @author Angle Core Team\\n/// @notice Interface for the `Treasury` contract\\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\\n/// of this module\\ninterface ITreasury {\\n /// @notice Checks whether a given address has well been initialized in this contract\\n /// as a `VaultManager``\\n /// @param _vaultManager Address to check\\n /// @return Whether the address has been initialized or not\\n function isVaultManager(address _vaultManager) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x36bd50a0ab1c46503bb64b8d5777bf3b4fd2da0e2dcfe68c8a9702eb132eb3e2\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVaultManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./ITreasury.sol\\\";\\n\\n// ========================= Key Structs and Enums =============================\\n\\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\\n/// to the caller or associated addresses\\nstruct PaymentData {\\n // Stablecoin amount the contract should give\\n uint256 stablecoinAmountToGive;\\n // Stablecoin amount owed to the contract\\n uint256 stablecoinAmountToReceive;\\n // Collateral amount the contract should give\\n uint256 collateralAmountToGive;\\n // Collateral amount owed to the contract\\n uint256 collateralAmountToReceive;\\n}\\n\\n/// @notice Data stored to track someone's loan (or equivalently called position)\\nstruct Vault {\\n // Amount of collateral deposited in the vault\\n uint256 collateralAmount;\\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\\n uint256 normalizedDebt;\\n}\\n\\n/// @notice Actions possible when composing calls to the different entry functions proposed\\nenum ActionBorrowType {\\n createVault,\\n closeVault,\\n addCollateral,\\n removeCollateral,\\n repayDebt,\\n borrow,\\n getDebtIn,\\n permit\\n}\\n\\n// ========================= Interfaces =============================\\n\\n/// @title IVaultManagerFunctions\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface only contains functions of the contract which are called by other contracts\\n/// of this module (without getters)\\ninterface IVaultManagerFunctions {\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\\n /// @param repayData Data to pass to the repayment contract in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to,\\n address who,\\n bytes memory repayData\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Checks whether a given address is approved for a vault or owns this vault\\n /// @param spender Address for which vault ownership should be checked\\n /// @param vaultID ID of the vault to check\\n /// @return Whether the `spender` address owns or is approved for `vaultID`\\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\\n\\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\\n /// @param spender Address to give approval to\\n /// @param approved Whether to give or revoke the approval\\n /// @param deadline Deadline parameter for the signature to be valid\\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\\n function permit(\\n address owner,\\n address spender,\\n bool approved,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\\n/// @title IVaultManagerStorage\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface contains getters of the contract's public variables used by other contracts\\n/// of this module\\ninterface IVaultManagerStorage {\\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\\n function treasury() external view returns (ITreasury);\\n\\n /// @notice Reference to the collateral handled by this `VaultManager`\\n function collateral() external view returns (IERC20);\\n\\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\\n function vaultIDCount() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4cf6dc5e5b494165e4d9e524dca5c65f6307e5b005a62287c5e84f1539dc81f1\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title Interface for WETH9\\ninterface IWETH9 is IERC20 {\\n /// @notice Deposit ether to get wrapped ether\\n function deposit() external payable;\\n\\n /// @notice Withdraw wrapped ether to get ether\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0xb109c1d668416c05f61d6edea2ec7a10b2f8b386fd51a59cc12f929c73d00424\",\"license\":\"GPL-2.0-or-later\"},\"contracts/interfaces/external/uniswap/IUniswapRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nstruct ExactInputParams {\\n bytes path;\\n address recipient;\\n uint256 deadline;\\n uint256 amountIn;\\n uint256 amountOutMinimum;\\n}\\n\\n/// @title Router token swapping functionality\\n/// @notice Functions for swapping tokens via Uniswap V3\\ninterface IUniswapV3Router {\\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\\n /// @return amountOut The amount of the received token\\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\\n}\\n\\n/// @title Router for price estimation functionality\\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\\n/// @dev This interface is only used for non critical elements of the protocol\\ninterface IUniswapV2Router {\\n /// @notice Given an input asset amount, returns the maximum output amount of the\\n /// other asset (accounting for fees) given reserves.\\n /// @param path Addresses of the pools used to get prices\\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\\n\\n function swapExactTokensForTokens(\\n uint256 swapAmount,\\n uint256 minExpected,\\n address[] calldata path,\\n address receiver,\\n uint256 swapDeadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x1908fcdc6ff78ad2250f6ccacc7129df464a648cb2a5f376bedbe506d058bb73\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620018d51760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b613f52806200015c6000396000f3fe6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073e5d7c2a44ffddf6b295a15c148167daaaf5cf34f73ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b600073e5d7c2a44ffddf6b295a15c148167daaaf5cf34f6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273e5d7c2a44ffddf6b295a15c148167daaaf5cf34f90632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220ffec7d45dc13f1688e816387648749ef5a6787684908f2243f2c61e9dd2993da64736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073e5d7c2a44ffddf6b295a15c148167daaaf5cf34f73ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b600073e5d7c2a44ffddf6b295a15c148167daaaf5cf34f6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273e5d7c2a44ffddf6b295a15c148167daaaf5cf34f90632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea2646970667358221220ffec7d45dc13f1688e816387648749ef5a6787684908f2243f2c61e9dd2993da64736f6c63430008110033", + "devdoc": { + "author": "Angle Core Team", + "kind": "dev", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "params": { + "amounts": "Amounts to allow", + "spenders": "Addresses to allow transfer", + "tokens": "Addresses of the tokens to allow" + } + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens", + "params": { + "actions": "List of actions to be performed by the router (in order of execution)", + "data": "Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored", + "paramsPermit": "Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it" + } + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option", + "params": { + "paramsPermitVaultManager": "Parameters to sign permit to give allowance to the router for a `VaultManager` contract" + } + } + }, + "title": "AngleRouterLinea", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "notice": "Changes allowances for different tokens" + }, + "core()": { + "notice": "Core address handling access control" + }, + "deposit4626Referral(address,address,uint256,address,uint256,address)": { + "notice": "Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract" + }, + "initializeRouter(address,address,address)": { + "notice": "Deploys the router contract on a chain" + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Allows composable calls to different functions within the protocol" + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions" + }, + "oneInch()": { + "notice": "Address of 1Inch router used for swaps" + }, + "setCore(address)": { + "notice": "Sets a new `core` contract" + }, + "setRouter(address,uint8)": { + "notice": "Sets a new router variable" + }, + "uniswapV3Router()": { + "notice": "Address of the router used for swaps" + } + }, + "notice": "Router contract built specifially for Angle use cases on Linea", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6, + "contract": "contracts/implementations/linea/AngleRouterLinea.sol:AngleRouterLinea", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 9, + "contract": "contracts/implementations/linea/AngleRouterLinea.sol:AngleRouterLinea", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 6523, + "contract": "contracts/implementations/linea/AngleRouterLinea.sol:AngleRouterLinea", + "label": "core", + "offset": 2, + "slot": "0", + "type": "t_contract(ICoreBorrow)9219" + }, + { + "astId": 6527, + "contract": "contracts/implementations/linea/AngleRouterLinea.sol:AngleRouterLinea", + "label": "uniswapV3Router", + "offset": 0, + "slot": "1", + "type": "t_contract(IUniswapV3Router)9756" + }, + { + "astId": 6530, + "contract": "contracts/implementations/linea/AngleRouterLinea.sol:AngleRouterLinea", + "label": "oneInch", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 6534, + "contract": "contracts/implementations/linea/AngleRouterLinea.sol:AngleRouterLinea", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint256)47_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ICoreBorrow)9219": { + "encoding": "inplace", + "label": "contract ICoreBorrow", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Router)9756": { + "encoding": "inplace", + "label": "contract IUniswapV3Router", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/linea/solcInputs/2560f9a5795a08bc300fefd5eee2c52b.json b/deployments/linea/solcInputs/2560f9a5795a08bc300fefd5eee2c52b.json new file mode 100644 index 0000000..d0871ad --- /dev/null +++ b/deployments/linea/solcInputs/2560f9a5795a08bc300fefd5eee2c52b.json @@ -0,0 +1,298 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/ERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20Upgradeable.sol\";\nimport \"./extensions/IERC20MetadataUpgradeable.sol\";\nimport \"../../utils/ContextUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20Upgradeable is Initializable, ContextUpgradeable, IERC20Upgradeable, IERC20MetadataUpgradeable {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n function __ERC20_init(string memory name_, string memory symbol_) internal onlyInitializing {\n __ERC20_init_unchained(name_, symbol_);\n }\n\n function __ERC20_init_unchained(string memory name_, string memory symbol_) internal onlyInitializing {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[45] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20PermitUpgradeable.sol\";\nimport \"../ERC20Upgradeable.sol\";\nimport \"../../../utils/cryptography/draft-EIP712Upgradeable.sol\";\nimport \"../../../utils/cryptography/ECDSAUpgradeable.sol\";\nimport \"../../../utils/CountersUpgradeable.sol\";\nimport \"../../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 51\n */\nabstract contract ERC20PermitUpgradeable is Initializable, ERC20Upgradeable, IERC20PermitUpgradeable, EIP712Upgradeable {\n using CountersUpgradeable for CountersUpgradeable.Counter;\n\n mapping(address => CountersUpgradeable.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n function __ERC20Permit_init(string memory name) internal onlyInitializing {\n __EIP712_init_unchained(name, \"1\");\n }\n\n function __ERC20Permit_init_unchained(string memory) internal onlyInitializing {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSAUpgradeable.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n CountersUpgradeable.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[49] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/IERC20MetadataUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20Upgradeable.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20MetadataUpgradeable is IERC20Upgradeable {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n function __Context_init() internal onlyInitializing {\n }\n\n function __Context_init_unchained() internal onlyInitializing {\n }\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/CountersUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary CountersUpgradeable {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/draft-EIP712Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSAUpgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n *\n * @custom:storage-size 52\n */\nabstract contract EIP712Upgradeable is Initializable {\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private constant _TYPE_HASH = keccak256(\"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\");\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n function __EIP712_init(string memory name, string memory version) internal onlyInitializing {\n __EIP712_init_unchained(name, version);\n }\n\n function __EIP712_init_unchained(string memory name, string memory version) internal onlyInitializing {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n return _buildDomainSeparator(_TYPE_HASH, _EIP712NameHash(), _EIP712VersionHash());\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSAUpgradeable.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n\n /**\n * @dev The hash of the name parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712NameHash() internal virtual view returns (bytes32) {\n return _HASHED_NAME;\n }\n\n /**\n * @dev The hash of the version parameter for the EIP712 domain.\n *\n * NOTE: This function reads from storage by default, but can be redefined to return a constant value if gas costs\n * are a concern.\n */\n function _EIP712VersionHash() internal virtual view returns (bytes32) {\n return _HASHED_VERSION;\n }\n\n /**\n * @dev This empty reserved space is put in place to allow future versions to add new\n * variables without shifting down storage in the inheritance chain.\n * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n */\n uint256[50] private __gap;\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../StringsUpgradeable.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSAUpgradeable {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", StringsUpgradeable.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "@openzeppelin/contracts/access/Ownable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../utils/Context.sol\";\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 * By default, the owner account will be the one that deploys the contract. This\n * can later be changed with {transferOwnership}.\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 */\nabstract contract Ownable is Context {\n address private _owner;\n\n event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);\n\n /**\n * @dev Initializes the contract setting the deployer as the initial owner.\n */\n constructor() {\n _transferOwnership(_msgSender());\n }\n\n /**\n * @dev Throws if called by any account other than the owner.\n */\n modifier onlyOwner() {\n _checkOwner();\n _;\n }\n\n /**\n * @dev Returns the address of the current owner.\n */\n function owner() public view virtual returns (address) {\n return _owner;\n }\n\n /**\n * @dev Throws if the sender is not the owner.\n */\n function _checkOwner() internal view virtual {\n require(owner() == _msgSender(), \"Ownable: caller is not the 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 _transferOwnership(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 require(newOwner != address(0), \"Ownable: new owner is the zero address\");\n _transferOwnership(newOwner);\n }\n\n /**\n * @dev Transfers ownership of the contract to a new account (`newOwner`).\n * Internal function without access restriction.\n */\n function _transferOwnership(address newOwner) internal virtual {\n address oldOwner = _owner;\n _owner = newOwner;\n emit OwnershipTransferred(oldOwner, newOwner);\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/draft-IERC1822.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (interfaces/draft-IERC1822.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev ERC1822: Universal Upgradeable Proxy Standard (UUPS) documents a method for upgradeability through a simplified\n * proxy whose upgrades are fully controlled by the current implementation.\n */\ninterface IERC1822Proxiable {\n /**\n * @dev Returns the storage slot that the proxiable contract assumes is being used to store the implementation\n * address.\n *\n * IMPORTANT: A proxy pointing at a proxiable contract should not be considered proxiable itself, because this risks\n * bricking a proxy that upgrades to it, by delegating to itself until out of gas. Thus it is critical that this\n * function revert if invoked through a proxy.\n */\n function proxiableUUID() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/proxy/beacon/IBeacon.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (proxy/beacon/IBeacon.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This is the interface that {BeaconProxy} expects of its beacon.\n */\ninterface IBeacon {\n /**\n * @dev Must return an address that can be used as a delegate call target.\n *\n * {BeaconProxy} will check that this address is a contract.\n */\n function implementation() external view returns (address);\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/ERC1967/ERC1967Proxy.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Proxy.sol\";\nimport \"./ERC1967Upgrade.sol\";\n\n/**\n * @dev This contract implements an upgradeable proxy. It is upgradeable because calls are delegated to an\n * implementation address that can be changed. This address is stored in storage in the location specified by\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967], so that it doesn't conflict with the storage layout of the\n * implementation behind the proxy.\n */\ncontract ERC1967Proxy is Proxy, ERC1967Upgrade {\n /**\n * @dev Initializes the upgradeable proxy with an initial implementation specified by `_logic`.\n *\n * If `_data` is nonempty, it's used as data in a delegate call to `_logic`. This will typically be an encoded\n * function call, and allows initializing the storage of the proxy like a Solidity constructor.\n */\n constructor(address _logic, bytes memory _data) payable {\n _upgradeToAndCall(_logic, _data, false);\n }\n\n /**\n * @dev Returns the current implementation address.\n */\n function _implementation() internal view virtual override returns (address impl) {\n return ERC1967Upgrade._getImplementation();\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/ERC1967/ERC1967Upgrade.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/ERC1967/ERC1967Upgrade.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../beacon/IBeacon.sol\";\nimport \"../../interfaces/draft-IERC1822.sol\";\nimport \"../../utils/Address.sol\";\nimport \"../../utils/StorageSlot.sol\";\n\n/**\n * @dev This abstract contract provides getters and event emitting update functions for\n * https://eips.ethereum.org/EIPS/eip-1967[EIP1967] slots.\n *\n * _Available since v4.1._\n *\n * @custom:oz-upgrades-unsafe-allow delegatecall\n */\nabstract contract ERC1967Upgrade {\n // This is the keccak-256 hash of \"eip1967.proxy.rollback\" subtracted by 1\n bytes32 private constant _ROLLBACK_SLOT = 0x4910fdfa16fed3260ed0e7147f7cc6da11a60208b5b9406d12a635614ffd9143;\n\n /**\n * @dev Storage slot with the address of the current implementation.\n * This is the keccak-256 hash of \"eip1967.proxy.implementation\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n\n /**\n * @dev Emitted when the implementation is upgraded.\n */\n event Upgraded(address indexed implementation);\n\n /**\n * @dev Returns the current implementation address.\n */\n function _getImplementation() internal view returns (address) {\n return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 implementation slot.\n */\n function _setImplementation(address newImplementation) private {\n require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n }\n\n /**\n * @dev Perform implementation upgrade\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeTo(address newImplementation) internal {\n _setImplementation(newImplementation);\n emit Upgraded(newImplementation);\n }\n\n /**\n * @dev Perform implementation upgrade with additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCall(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n _upgradeTo(newImplementation);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(newImplementation, data);\n }\n }\n\n /**\n * @dev Perform implementation upgrade with security checks for UUPS proxies, and additional setup call.\n *\n * Emits an {Upgraded} event.\n */\n function _upgradeToAndCallUUPS(\n address newImplementation,\n bytes memory data,\n bool forceCall\n ) internal {\n // Upgrades from old implementations will perform a rollback test. This test requires the new\n // implementation to upgrade back to the old, non-ERC1822 compliant, implementation. Removing\n // this special case will break upgrade paths from old UUPS implementation to new ones.\n if (StorageSlot.getBooleanSlot(_ROLLBACK_SLOT).value) {\n _setImplementation(newImplementation);\n } else {\n try IERC1822Proxiable(newImplementation).proxiableUUID() returns (bytes32 slot) {\n require(slot == _IMPLEMENTATION_SLOT, \"ERC1967Upgrade: unsupported proxiableUUID\");\n } catch {\n revert(\"ERC1967Upgrade: new implementation is not UUPS\");\n }\n _upgradeToAndCall(newImplementation, data, forceCall);\n }\n }\n\n /**\n * @dev Storage slot with the admin of the contract.\n * This is the keccak-256 hash of \"eip1967.proxy.admin\" subtracted by 1, and is\n * validated in the constructor.\n */\n bytes32 internal constant _ADMIN_SLOT = 0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103;\n\n /**\n * @dev Emitted when the admin account has changed.\n */\n event AdminChanged(address previousAdmin, address newAdmin);\n\n /**\n * @dev Returns the current admin.\n */\n function _getAdmin() internal view returns (address) {\n return StorageSlot.getAddressSlot(_ADMIN_SLOT).value;\n }\n\n /**\n * @dev Stores a new address in the EIP1967 admin slot.\n */\n function _setAdmin(address newAdmin) private {\n require(newAdmin != address(0), \"ERC1967: new admin is the zero address\");\n StorageSlot.getAddressSlot(_ADMIN_SLOT).value = newAdmin;\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n */\n function _changeAdmin(address newAdmin) internal {\n emit AdminChanged(_getAdmin(), newAdmin);\n _setAdmin(newAdmin);\n }\n\n /**\n * @dev The storage slot of the UpgradeableBeacon contract which defines the implementation for this proxy.\n * This is bytes32(uint256(keccak256('eip1967.proxy.beacon')) - 1)) and is validated in the constructor.\n */\n bytes32 internal constant _BEACON_SLOT = 0xa3f0ad74e5423aebfd80d3ef4346578335a9a72aeaee59ff6cb3582b35133d50;\n\n /**\n * @dev Emitted when the beacon is upgraded.\n */\n event BeaconUpgraded(address indexed beacon);\n\n /**\n * @dev Returns the current beacon.\n */\n function _getBeacon() internal view returns (address) {\n return StorageSlot.getAddressSlot(_BEACON_SLOT).value;\n }\n\n /**\n * @dev Stores a new beacon in the EIP1967 beacon slot.\n */\n function _setBeacon(address newBeacon) private {\n require(Address.isContract(newBeacon), \"ERC1967: new beacon is not a contract\");\n require(\n Address.isContract(IBeacon(newBeacon).implementation()),\n \"ERC1967: beacon implementation is not a contract\"\n );\n StorageSlot.getAddressSlot(_BEACON_SLOT).value = newBeacon;\n }\n\n /**\n * @dev Perform beacon upgrade with additional setup call. Note: This upgrades the address of the beacon, it does\n * not upgrade the implementation contained in the beacon (see {UpgradeableBeacon-_setImplementation} for that).\n *\n * Emits a {BeaconUpgraded} event.\n */\n function _upgradeBeaconToAndCall(\n address newBeacon,\n bytes memory data,\n bool forceCall\n ) internal {\n _setBeacon(newBeacon);\n emit BeaconUpgraded(newBeacon);\n if (data.length > 0 || forceCall) {\n Address.functionDelegateCall(IBeacon(newBeacon).implementation(), data);\n }\n }\n}\n" + }, + "@openzeppelin/contracts/proxy/Proxy.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (proxy/Proxy.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM\n * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to\n * be specified by overriding the virtual {_implementation} function.\n *\n * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a\n * different contract through the {_delegate} function.\n *\n * The success and return data of the delegated call will be returned back to the caller of the proxy.\n */\nabstract contract Proxy {\n /**\n * @dev Delegates the current call to `implementation`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _delegate(address implementation) internal virtual {\n assembly {\n // Copy msg.data. We take full control of memory in this inline assembly\n // block because it will not return to Solidity code. We overwrite the\n // Solidity scratch pad at memory position 0.\n calldatacopy(0, 0, calldatasize())\n\n // Call the implementation.\n // out and outsize are 0 because we don't know the size yet.\n let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)\n\n // Copy the returned data.\n returndatacopy(0, 0, returndatasize())\n\n switch result\n // delegatecall returns 0 on error.\n case 0 {\n revert(0, returndatasize())\n }\n default {\n return(0, returndatasize())\n }\n }\n }\n\n /**\n * @dev This is a virtual function that should be overridden so it returns the address to which the fallback function\n * and {_fallback} should delegate.\n */\n function _implementation() internal view virtual returns (address);\n\n /**\n * @dev Delegates the current call to the address returned by `_implementation()`.\n *\n * This function does not return to its internal call site, it will return directly to the external caller.\n */\n function _fallback() internal virtual {\n _beforeFallback();\n _delegate(_implementation());\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other\n * function in the contract matches the call data.\n */\n fallback() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if call data\n * is empty.\n */\n receive() external payable virtual {\n _fallback();\n }\n\n /**\n * @dev Hook that is called before falling back to the implementation. Can happen as part of a manual `_fallback`\n * call, or as part of the Solidity `fallback` or `receive` functions.\n *\n * If overridden should call `super._beforeFallback()`.\n */\n function _beforeFallback() internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/ERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/ERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC20.sol\";\nimport \"./extensions/IERC20Metadata.sol\";\nimport \"../../utils/Context.sol\";\n\n/**\n * @dev Implementation of the {IERC20} interface.\n *\n * This implementation is agnostic to the way tokens are created. This means\n * that a supply mechanism has to be added in a derived contract using {_mint}.\n * For a generic mechanism see {ERC20PresetMinterPauser}.\n *\n * TIP: For a detailed writeup see our guide\n * https://forum.zeppelin.solutions/t/how-to-implement-erc20-supply-mechanisms/226[How\n * to implement supply mechanisms].\n *\n * We have followed general OpenZeppelin Contracts guidelines: functions revert\n * instead returning `false` on failure. This behavior is nonetheless\n * conventional and does not conflict with the expectations of ERC20\n * applications.\n *\n * Additionally, an {Approval} event is emitted on calls to {transferFrom}.\n * This allows applications to reconstruct the allowance for all accounts just\n * by listening to said events. Other implementations of the EIP may not emit\n * these events, as it isn't required by the specification.\n *\n * Finally, the non-standard {decreaseAllowance} and {increaseAllowance}\n * functions have been added to mitigate the well-known issues around setting\n * allowances. See {IERC20-approve}.\n */\ncontract ERC20 is Context, IERC20, IERC20Metadata {\n mapping(address => uint256) private _balances;\n\n mapping(address => mapping(address => uint256)) private _allowances;\n\n uint256 private _totalSupply;\n\n string private _name;\n string private _symbol;\n\n /**\n * @dev Sets the values for {name} and {symbol}.\n *\n * The default value of {decimals} is 18. To select a different value for\n * {decimals} you should overload it.\n *\n * All two of these values are immutable: they can only be set once during\n * construction.\n */\n constructor(string memory name_, string memory symbol_) {\n _name = name_;\n _symbol = symbol_;\n }\n\n /**\n * @dev Returns the name of the token.\n */\n function name() public view virtual override returns (string memory) {\n return _name;\n }\n\n /**\n * @dev Returns the symbol of the token, usually a shorter version of the\n * name.\n */\n function symbol() public view virtual override returns (string memory) {\n return _symbol;\n }\n\n /**\n * @dev Returns the number of decimals used to get its user representation.\n * For example, if `decimals` equals `2`, a balance of `505` tokens should\n * be displayed to a user as `5.05` (`505 / 10 ** 2`).\n *\n * Tokens usually opt for a value of 18, imitating the relationship between\n * Ether and Wei. This is the value {ERC20} uses, unless this function is\n * overridden;\n *\n * NOTE: This information is only used for _display_ purposes: it in\n * no way affects any of the arithmetic of the contract, including\n * {IERC20-balanceOf} and {IERC20-transfer}.\n */\n function decimals() public view virtual override returns (uint8) {\n return 18;\n }\n\n /**\n * @dev See {IERC20-totalSupply}.\n */\n function totalSupply() public view virtual override returns (uint256) {\n return _totalSupply;\n }\n\n /**\n * @dev See {IERC20-balanceOf}.\n */\n function balanceOf(address account) public view virtual override returns (uint256) {\n return _balances[account];\n }\n\n /**\n * @dev See {IERC20-transfer}.\n *\n * Requirements:\n *\n * - `to` cannot be the zero address.\n * - the caller must have a balance of at least `amount`.\n */\n function transfer(address to, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _transfer(owner, to, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-allowance}.\n */\n function allowance(address owner, address spender) public view virtual override returns (uint256) {\n return _allowances[owner][spender];\n }\n\n /**\n * @dev See {IERC20-approve}.\n *\n * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on\n * `transferFrom`. This is semantically equivalent to an infinite approval.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function approve(address spender, uint256 amount) public virtual override returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, amount);\n return true;\n }\n\n /**\n * @dev See {IERC20-transferFrom}.\n *\n * Emits an {Approval} event indicating the updated allowance. This is not\n * required by the EIP. See the note at the beginning of {ERC20}.\n *\n * NOTE: Does not update the allowance if the current allowance\n * is the maximum `uint256`.\n *\n * Requirements:\n *\n * - `from` and `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n * - the caller must have allowance for ``from``'s tokens of at least\n * `amount`.\n */\n function transferFrom(\n address from,\n address to,\n uint256 amount\n ) public virtual override returns (bool) {\n address spender = _msgSender();\n _spendAllowance(from, spender, amount);\n _transfer(from, to, amount);\n return true;\n }\n\n /**\n * @dev Atomically increases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n */\n function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) {\n address owner = _msgSender();\n _approve(owner, spender, allowance(owner, spender) + addedValue);\n return true;\n }\n\n /**\n * @dev Atomically decreases the allowance granted to `spender` by the caller.\n *\n * This is an alternative to {approve} that can be used as a mitigation for\n * problems described in {IERC20-approve}.\n *\n * Emits an {Approval} event indicating the updated allowance.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `spender` must have allowance for the caller of at least\n * `subtractedValue`.\n */\n function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) {\n address owner = _msgSender();\n uint256 currentAllowance = allowance(owner, spender);\n require(currentAllowance >= subtractedValue, \"ERC20: decreased allowance below zero\");\n unchecked {\n _approve(owner, spender, currentAllowance - subtractedValue);\n }\n\n return true;\n }\n\n /**\n * @dev Moves `amount` of tokens from `from` to `to`.\n *\n * This internal function is equivalent to {transfer}, and can be used to\n * e.g. implement automatic token fees, slashing mechanisms, etc.\n *\n * Emits a {Transfer} event.\n *\n * Requirements:\n *\n * - `from` cannot be the zero address.\n * - `to` cannot be the zero address.\n * - `from` must have a balance of at least `amount`.\n */\n function _transfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {\n require(from != address(0), \"ERC20: transfer from the zero address\");\n require(to != address(0), \"ERC20: transfer to the zero address\");\n\n _beforeTokenTransfer(from, to, amount);\n\n uint256 fromBalance = _balances[from];\n require(fromBalance >= amount, \"ERC20: transfer amount exceeds balance\");\n unchecked {\n _balances[from] = fromBalance - amount;\n }\n _balances[to] += amount;\n\n emit Transfer(from, to, amount);\n\n _afterTokenTransfer(from, to, amount);\n }\n\n /** @dev Creates `amount` tokens and assigns them to `account`, increasing\n * the total supply.\n *\n * Emits a {Transfer} event with `from` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n */\n function _mint(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: mint to the zero address\");\n\n _beforeTokenTransfer(address(0), account, amount);\n\n _totalSupply += amount;\n _balances[account] += amount;\n emit Transfer(address(0), account, amount);\n\n _afterTokenTransfer(address(0), account, amount);\n }\n\n /**\n * @dev Destroys `amount` tokens from `account`, reducing the\n * total supply.\n *\n * Emits a {Transfer} event with `to` set to the zero address.\n *\n * Requirements:\n *\n * - `account` cannot be the zero address.\n * - `account` must have at least `amount` tokens.\n */\n function _burn(address account, uint256 amount) internal virtual {\n require(account != address(0), \"ERC20: burn from the zero address\");\n\n _beforeTokenTransfer(account, address(0), amount);\n\n uint256 accountBalance = _balances[account];\n require(accountBalance >= amount, \"ERC20: burn amount exceeds balance\");\n unchecked {\n _balances[account] = accountBalance - amount;\n }\n _totalSupply -= amount;\n\n emit Transfer(account, address(0), amount);\n\n _afterTokenTransfer(account, address(0), amount);\n }\n\n /**\n * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens.\n *\n * This internal function is equivalent to `approve`, and can be used to\n * e.g. set automatic allowances for certain subsystems, etc.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `owner` cannot be the zero address.\n * - `spender` cannot be the zero address.\n */\n function _approve(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n require(owner != address(0), \"ERC20: approve from the zero address\");\n require(spender != address(0), \"ERC20: approve to the zero address\");\n\n _allowances[owner][spender] = amount;\n emit Approval(owner, spender, amount);\n }\n\n /**\n * @dev Updates `owner` s allowance for `spender` based on spent `amount`.\n *\n * Does not update the allowance amount in case of infinite allowance.\n * Revert if not enough allowance is available.\n *\n * Might emit an {Approval} event.\n */\n function _spendAllowance(\n address owner,\n address spender,\n uint256 amount\n ) internal virtual {\n uint256 currentAllowance = allowance(owner, spender);\n if (currentAllowance != type(uint256).max) {\n require(currentAllowance >= amount, \"ERC20: insufficient allowance\");\n unchecked {\n _approve(owner, spender, currentAllowance - amount);\n }\n }\n }\n\n /**\n * @dev Hook that is called before any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * will be transferred to `to`.\n * - when `from` is zero, `amount` tokens will be minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens will be burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _beforeTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n\n /**\n * @dev Hook that is called after any transfer of tokens. This includes\n * minting and burning.\n *\n * Calling conditions:\n *\n * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens\n * has been transferred to `to`.\n * - when `from` is zero, `amount` tokens have been minted for `to`.\n * - when `to` is zero, `amount` of ``from``'s tokens have been burned.\n * - `from` and `to` are never both zero.\n *\n * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks].\n */\n function _afterTokenTransfer(\n address from,\n address to,\n uint256 amount\n ) internal virtual {}\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/extensions/draft-ERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./draft-IERC20Permit.sol\";\nimport \"../ERC20.sol\";\nimport \"../../../utils/cryptography/draft-EIP712.sol\";\nimport \"../../../utils/cryptography/ECDSA.sol\";\nimport \"../../../utils/Counters.sol\";\n\n/**\n * @dev Implementation of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on `{IERC20-approve}`, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n *\n * _Available since v3.4._\n */\nabstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 {\n using Counters for Counters.Counter;\n\n mapping(address => Counters.Counter) private _nonces;\n\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private constant _PERMIT_TYPEHASH =\n keccak256(\"Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)\");\n /**\n * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`.\n * However, to ensure consistency with the upgradeable transpiler, we will continue\n * to reserve a slot.\n * @custom:oz-renamed-from _PERMIT_TYPEHASH\n */\n // solhint-disable-next-line var-name-mixedcase\n bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT;\n\n /**\n * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `\"1\"`.\n *\n * It's a good idea to use the same `name` that is defined as the ERC20 token name.\n */\n constructor(string memory name) EIP712(name, \"1\") {}\n\n /**\n * @dev See {IERC20Permit-permit}.\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) public virtual override {\n require(block.timestamp <= deadline, \"ERC20Permit: expired deadline\");\n\n bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline));\n\n bytes32 hash = _hashTypedDataV4(structHash);\n\n address signer = ECDSA.recover(hash, v, r, s);\n require(signer == owner, \"ERC20Permit: invalid signature\");\n\n _approve(owner, spender, value);\n }\n\n /**\n * @dev See {IERC20Permit-nonces}.\n */\n function nonces(address owner) public view virtual override returns (uint256) {\n return _nonces[owner].current();\n }\n\n /**\n * @dev See {IERC20Permit-DOMAIN_SEPARATOR}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view override returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /**\n * @dev \"Consume a nonce\": return the current value and increment.\n *\n * _Available since v4.1._\n */\n function _useNonce(address owner) internal virtual returns (uint256 current) {\n Counters.Counter storage nonce = _nonces[owner];\n current = nonce.current();\n nonce.increment();\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/extensions/ERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../ERC20.sol\";\nimport \"../utils/SafeERC20.sol\";\nimport \"../../../interfaces/IERC4626.sol\";\nimport \"../../../utils/math/Math.sol\";\n\n/**\n * @dev Implementation of the ERC4626 \"Tokenized Vault Standard\" as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[EIP-4626].\n *\n * This extension allows the minting and burning of \"shares\" (represented using the ERC20 inheritance) in exchange for\n * underlying \"assets\" through standardized {deposit}, {mint}, {redeem} and {burn} workflows. This contract extends\n * the ERC20 standard. Any additional extensions included along it would affect the \"shares\" token represented by this\n * contract and not the \"assets\" token which is an independent contract.\n *\n * CAUTION: Deposits and withdrawals may incur unexpected slippage. Users should verify that the amount received of\n * shares or assets is as expected. EOAs should operate through a wrapper that performs these checks such as\n * https://github.com/fei-protocol/ERC4626#erc4626router-and-base[ERC4626Router].\n *\n * _Available since v4.7._\n */\nabstract contract ERC4626 is ERC20, IERC4626 {\n using Math for uint256;\n\n IERC20Metadata private immutable _asset;\n\n /**\n * @dev Set the underlying asset contract. This must be an ERC20-compatible contract (ERC20 or ERC777).\n */\n constructor(IERC20Metadata asset_) {\n _asset = asset_;\n }\n\n /** @dev See {IERC4262-asset}. */\n function asset() public view virtual override returns (address) {\n return address(_asset);\n }\n\n /** @dev See {IERC4262-totalAssets}. */\n function totalAssets() public view virtual override returns (uint256) {\n return _asset.balanceOf(address(this));\n }\n\n /** @dev See {IERC4262-convertToShares}. */\n function convertToShares(uint256 assets) public view virtual override returns (uint256 shares) {\n return _convertToShares(assets, Math.Rounding.Down);\n }\n\n /** @dev See {IERC4262-convertToAssets}. */\n function convertToAssets(uint256 shares) public view virtual override returns (uint256 assets) {\n return _convertToAssets(shares, Math.Rounding.Down);\n }\n\n /** @dev See {IERC4262-maxDeposit}. */\n function maxDeposit(address) public view virtual override returns (uint256) {\n return _isVaultCollateralized() ? type(uint256).max : 0;\n }\n\n /** @dev See {IERC4262-maxMint}. */\n function maxMint(address) public view virtual override returns (uint256) {\n return type(uint256).max;\n }\n\n /** @dev See {IERC4262-maxWithdraw}. */\n function maxWithdraw(address owner) public view virtual override returns (uint256) {\n return _convertToAssets(balanceOf(owner), Math.Rounding.Down);\n }\n\n /** @dev See {IERC4262-maxRedeem}. */\n function maxRedeem(address owner) public view virtual override returns (uint256) {\n return balanceOf(owner);\n }\n\n /** @dev See {IERC4262-previewDeposit}. */\n function previewDeposit(uint256 assets) public view virtual override returns (uint256) {\n return _convertToShares(assets, Math.Rounding.Down);\n }\n\n /** @dev See {IERC4262-previewMint}. */\n function previewMint(uint256 shares) public view virtual override returns (uint256) {\n return _convertToAssets(shares, Math.Rounding.Up);\n }\n\n /** @dev See {IERC4262-previewWithdraw}. */\n function previewWithdraw(uint256 assets) public view virtual override returns (uint256) {\n return _convertToShares(assets, Math.Rounding.Up);\n }\n\n /** @dev See {IERC4262-previewRedeem}. */\n function previewRedeem(uint256 shares) public view virtual override returns (uint256) {\n return _convertToAssets(shares, Math.Rounding.Down);\n }\n\n /** @dev See {IERC4262-deposit}. */\n function deposit(uint256 assets, address receiver) public virtual override returns (uint256) {\n require(assets <= maxDeposit(receiver), \"ERC4626: deposit more than max\");\n\n uint256 shares = previewDeposit(assets);\n _deposit(_msgSender(), receiver, assets, shares);\n\n return shares;\n }\n\n /** @dev See {IERC4262-mint}. */\n function mint(uint256 shares, address receiver) public virtual override returns (uint256) {\n require(shares <= maxMint(receiver), \"ERC4626: mint more than max\");\n\n uint256 assets = previewMint(shares);\n _deposit(_msgSender(), receiver, assets, shares);\n\n return assets;\n }\n\n /** @dev See {IERC4262-withdraw}. */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) public virtual override returns (uint256) {\n require(assets <= maxWithdraw(owner), \"ERC4626: withdraw more than max\");\n\n uint256 shares = previewWithdraw(assets);\n _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n return shares;\n }\n\n /** @dev See {IERC4262-redeem}. */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) public virtual override returns (uint256) {\n require(shares <= maxRedeem(owner), \"ERC4626: redeem more than max\");\n\n uint256 assets = previewRedeem(shares);\n _withdraw(_msgSender(), receiver, owner, assets, shares);\n\n return assets;\n }\n\n /**\n * @dev Internal conversion function (from assets to shares) with support for rounding direction.\n *\n * Will revert if assets > 0, totalSupply > 0 and totalAssets = 0. That corresponds to a case where any asset\n * would represent an infinite amout of shares.\n */\n function _convertToShares(uint256 assets, Math.Rounding rounding) internal view virtual returns (uint256 shares) {\n uint256 supply = totalSupply();\n return\n (assets == 0 || supply == 0)\n ? assets.mulDiv(10**decimals(), 10**_asset.decimals(), rounding)\n : assets.mulDiv(supply, totalAssets(), rounding);\n }\n\n /**\n * @dev Internal conversion function (from shares to assets) with support for rounding direction.\n */\n function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view virtual returns (uint256 assets) {\n uint256 supply = totalSupply();\n return\n (supply == 0)\n ? shares.mulDiv(10**_asset.decimals(), 10**decimals(), rounding)\n : shares.mulDiv(totalAssets(), supply, rounding);\n }\n\n /**\n * @dev Deposit/mint common workflow.\n */\n function _deposit(\n address caller,\n address receiver,\n uint256 assets,\n uint256 shares\n ) internal virtual {\n // If _asset is ERC777, `transferFrom` can trigger a reenterancy BEFORE the transfer happens through the\n // `tokensToSend` hook. On the other hand, the `tokenReceived` hook, that is triggered after the transfer,\n // calls the vault, which is assumed not malicious.\n //\n // Conclusion: we need to do the transfer before we mint so that any reentrancy would happen before the\n // assets are transfered and before the shares are minted, which is a valid state.\n // slither-disable-next-line reentrancy-no-eth\n SafeERC20.safeTransferFrom(_asset, caller, address(this), assets);\n _mint(receiver, shares);\n\n emit Deposit(caller, receiver, assets, shares);\n }\n\n /**\n * @dev Withdraw/redeem common workflow.\n */\n function _withdraw(\n address caller,\n address receiver,\n address owner,\n uint256 assets,\n uint256 shares\n ) internal virtual {\n if (caller != owner) {\n _spendAllowance(owner, caller, shares);\n }\n\n // If _asset is ERC777, `transfer` can trigger a reentrancy AFTER the transfer happens through the\n // `tokensReceived` hook. On the other hand, the `tokensToSend` hook, that is triggered before the transfer,\n // calls the vault, which is assumed not malicious.\n //\n // Conclusion: we need to do the transfer after the burn so that any reentrancy would happen after the\n // shares are burned and after the assets are transfered, which is a valid state.\n _burn(owner, shares);\n SafeERC20.safeTransfer(_asset, receiver, assets);\n\n emit Withdraw(caller, receiver, owner, assets, shares);\n }\n\n function _isVaultCollateralized() private view returns (bool) {\n return totalAssets() > 0 || totalSupply() == 0;\n }\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\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 IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\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 require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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 */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\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. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Context.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract Context {\n function _msgSender() internal view virtual returns (address) {\n return msg.sender;\n }\n\n function _msgData() internal view virtual returns (bytes calldata) {\n return msg.data;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Counters.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Counters.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @title Counters\n * @author Matt Condon (@shrugs)\n * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number\n * of elements in a mapping, issuing ERC721 ids, or counting request ids.\n *\n * Include with `using Counters for Counters.Counter;`\n */\nlibrary Counters {\n struct Counter {\n // This variable should never be directly accessed by users of the library: interactions must be restricted to\n // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add\n // this feature: see https://github.com/ethereum/solidity/issues/4637\n uint256 _value; // default: 0\n }\n\n function current(Counter storage counter) internal view returns (uint256) {\n return counter._value;\n }\n\n function increment(Counter storage counter) internal {\n unchecked {\n counter._value += 1;\n }\n }\n\n function decrement(Counter storage counter) internal {\n uint256 value = counter._value;\n require(value > 0, \"Counter: decrement overflow\");\n unchecked {\n counter._value = value - 1;\n }\n }\n\n function reset(Counter storage counter) internal {\n counter._value = 0;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/draft-EIP712.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/cryptography/draft-EIP712.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./ECDSA.sol\";\n\n/**\n * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data.\n *\n * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible,\n * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding\n * they need in their contracts using a combination of `abi.encode` and `keccak256`.\n *\n * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding\n * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA\n * ({_hashTypedDataV4}).\n *\n * The implementation of the domain separator was designed to be as efficient as possible while still properly updating\n * the chain id to protect against replay attacks on an eventual fork of the chain.\n *\n * NOTE: This contract implements the version of the encoding known as \"v4\", as implemented by the JSON RPC method\n * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask].\n *\n * _Available since v3.4._\n */\nabstract contract EIP712 {\n /* solhint-disable var-name-mixedcase */\n // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to\n // invalidate the cached domain separator if the chain id changes.\n bytes32 private immutable _CACHED_DOMAIN_SEPARATOR;\n uint256 private immutable _CACHED_CHAIN_ID;\n address private immutable _CACHED_THIS;\n\n bytes32 private immutable _HASHED_NAME;\n bytes32 private immutable _HASHED_VERSION;\n bytes32 private immutable _TYPE_HASH;\n\n /* solhint-enable var-name-mixedcase */\n\n /**\n * @dev Initializes the domain separator and parameter caches.\n *\n * The meaning of `name` and `version` is specified in\n * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]:\n *\n * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol.\n * - `version`: the current major version of the signing domain.\n *\n * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart\n * contract upgrade].\n */\n constructor(string memory name, string memory version) {\n bytes32 hashedName = keccak256(bytes(name));\n bytes32 hashedVersion = keccak256(bytes(version));\n bytes32 typeHash = keccak256(\n \"EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)\"\n );\n _HASHED_NAME = hashedName;\n _HASHED_VERSION = hashedVersion;\n _CACHED_CHAIN_ID = block.chainid;\n _CACHED_DOMAIN_SEPARATOR = _buildDomainSeparator(typeHash, hashedName, hashedVersion);\n _CACHED_THIS = address(this);\n _TYPE_HASH = typeHash;\n }\n\n /**\n * @dev Returns the domain separator for the current chain.\n */\n function _domainSeparatorV4() internal view returns (bytes32) {\n if (address(this) == _CACHED_THIS && block.chainid == _CACHED_CHAIN_ID) {\n return _CACHED_DOMAIN_SEPARATOR;\n } else {\n return _buildDomainSeparator(_TYPE_HASH, _HASHED_NAME, _HASHED_VERSION);\n }\n }\n\n function _buildDomainSeparator(\n bytes32 typeHash,\n bytes32 nameHash,\n bytes32 versionHash\n ) private view returns (bytes32) {\n return keccak256(abi.encode(typeHash, nameHash, versionHash, block.chainid, address(this)));\n }\n\n /**\n * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this\n * function returns the hash of the fully encoded EIP712 message for this domain.\n *\n * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example:\n *\n * ```solidity\n * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode(\n * keccak256(\"Mail(address to,string contents)\"),\n * mailTo,\n * keccak256(bytes(mailContents))\n * )));\n * address signer = ECDSA.recover(digest, signature);\n * ```\n */\n function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) {\n return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash);\n }\n}\n" + }, + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/ECDSA.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../Strings.sol\";\n\n/**\n * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations.\n *\n * These functions can be used to verify that a message was signed by the holder\n * of the private keys of a given address.\n */\nlibrary ECDSA {\n enum RecoverError {\n NoError,\n InvalidSignature,\n InvalidSignatureLength,\n InvalidSignatureS,\n InvalidSignatureV\n }\n\n function _throwError(RecoverError error) private pure {\n if (error == RecoverError.NoError) {\n return; // no error: do nothing\n } else if (error == RecoverError.InvalidSignature) {\n revert(\"ECDSA: invalid signature\");\n } else if (error == RecoverError.InvalidSignatureLength) {\n revert(\"ECDSA: invalid signature length\");\n } else if (error == RecoverError.InvalidSignatureS) {\n revert(\"ECDSA: invalid signature 's' value\");\n } else if (error == RecoverError.InvalidSignatureV) {\n revert(\"ECDSA: invalid signature 'v' value\");\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature` or error string. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n *\n * Documentation for signature generation:\n * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js]\n * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers]\n *\n * _Available since v4.3._\n */\n function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) {\n // Check the signature length\n // - case 65: r,s,v signature (standard)\n // - case 64: r,vs signature (cf https://eips.ethereum.org/EIPS/eip-2098) _Available since v4.1._\n if (signature.length == 65) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n s := mload(add(signature, 0x40))\n v := byte(0, mload(add(signature, 0x60)))\n }\n return tryRecover(hash, v, r, s);\n } else if (signature.length == 64) {\n bytes32 r;\n bytes32 vs;\n // ecrecover takes the signature parameters, and the only way to get them\n // currently is to use assembly.\n /// @solidity memory-safe-assembly\n assembly {\n r := mload(add(signature, 0x20))\n vs := mload(add(signature, 0x40))\n }\n return tryRecover(hash, r, vs);\n } else {\n return (address(0), RecoverError.InvalidSignatureLength);\n }\n }\n\n /**\n * @dev Returns the address that signed a hashed message (`hash`) with\n * `signature`. This address can then be used for verification purposes.\n *\n * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures:\n * this function rejects them by requiring the `s` value to be in the lower\n * half order, and the `v` value to be either 27 or 28.\n *\n * IMPORTANT: `hash` _must_ be the result of a hash operation for the\n * verification to be secure: it is possible to craft signatures that\n * recover to arbitrary addresses for non-hashed data. A safe way to ensure\n * this is by receiving a hash of the original message (which may otherwise\n * be too long), and then calling {toEthSignedMessageHash} on it.\n */\n function recover(bytes32 hash, bytes memory signature) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, signature);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately.\n *\n * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures]\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address, RecoverError) {\n bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff);\n uint8 v = uint8((uint256(vs) >> 255) + 27);\n return tryRecover(hash, v, r, s);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately.\n *\n * _Available since v4.2._\n */\n function recover(\n bytes32 hash,\n bytes32 r,\n bytes32 vs\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, r, vs);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Overload of {ECDSA-tryRecover} that receives the `v`,\n * `r` and `s` signature fields separately.\n *\n * _Available since v4.3._\n */\n function tryRecover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address, RecoverError) {\n // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature\n // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines\n // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most\n // signatures from current libraries generate a unique signature with an s-value in the lower half order.\n //\n // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value\n // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or\n // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept\n // these malleable signatures as well.\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) {\n return (address(0), RecoverError.InvalidSignatureS);\n }\n if (v != 27 && v != 28) {\n return (address(0), RecoverError.InvalidSignatureV);\n }\n\n // If the signature is valid (and not malleable), return the signer address\n address signer = ecrecover(hash, v, r, s);\n if (signer == address(0)) {\n return (address(0), RecoverError.InvalidSignature);\n }\n\n return (signer, RecoverError.NoError);\n }\n\n /**\n * @dev Overload of {ECDSA-recover} that receives the `v`,\n * `r` and `s` signature fields separately.\n */\n function recover(\n bytes32 hash,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal pure returns (address) {\n (address recovered, RecoverError error) = tryRecover(hash, v, r, s);\n _throwError(error);\n return recovered;\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from a `hash`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32) {\n // 32 is the length in bytes of hash,\n // enforced by the type signature above\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n32\", hash));\n }\n\n /**\n * @dev Returns an Ethereum Signed Message, created from `s`. This\n * produces hash corresponding to the one signed with the\n * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`]\n * JSON-RPC method as part of EIP-191.\n *\n * See {recover}.\n */\n function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19Ethereum Signed Message:\\n\", Strings.toString(s.length), s));\n }\n\n /**\n * @dev Returns an Ethereum Signed Typed Data, created from a\n * `domainSeparator` and a `structHash`. This produces hash corresponding\n * to the one signed with the\n * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`]\n * JSON-RPC method as part of EIP-712.\n *\n * See {recover}.\n */\n function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32) {\n return keccak256(abi.encodePacked(\"\\x19\\x01\", domainSeparator, structHash));\n }\n}\n" + }, + "@openzeppelin/contracts/utils/math/Math.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/math/Math.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Standard math utilities missing in the Solidity language.\n */\nlibrary Math {\n enum Rounding {\n Down, // Toward negative infinity\n Up, // Toward infinity\n Zero // Toward zero\n }\n\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.\n return (a & b) + (a ^ b) / 2;\n }\n\n /**\n * @dev Returns the ceiling of the division of two numbers.\n *\n * This differs from standard division with `/` in that it rounds up instead\n * of rounding down.\n */\n function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) {\n // (a + b - 1) / b can overflow on addition, so we distribute.\n return a == 0 ? 0 : (a - 1) / b + 1;\n }\n\n /**\n * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0\n * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv)\n * with further edits by Uniswap Labs also under MIT license.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator\n ) internal pure returns (uint256 result) {\n unchecked {\n // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use\n // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256\n // variables such that product = prod1 * 2^256 + prod0.\n uint256 prod0; // Least significant 256 bits of the product\n uint256 prod1; // Most significant 256 bits of the product\n assembly {\n let mm := mulmod(x, y, not(0))\n prod0 := mul(x, y)\n prod1 := sub(sub(mm, prod0), lt(mm, prod0))\n }\n\n // Handle non-overflow cases, 256 by 256 division.\n if (prod1 == 0) {\n return prod0 / denominator;\n }\n\n // Make sure the result is less than 2^256. Also prevents denominator == 0.\n require(denominator > prod1);\n\n ///////////////////////////////////////////////\n // 512 by 256 division.\n ///////////////////////////////////////////////\n\n // Make division exact by subtracting the remainder from [prod1 prod0].\n uint256 remainder;\n assembly {\n // Compute remainder using mulmod.\n remainder := mulmod(x, y, denominator)\n\n // Subtract 256 bit number from 512 bit number.\n prod1 := sub(prod1, gt(remainder, prod0))\n prod0 := sub(prod0, remainder)\n }\n\n // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1.\n // See https://cs.stackexchange.com/q/138556/92363.\n\n // Does not overflow because the denominator cannot be zero at this stage in the function.\n uint256 twos = denominator & (~denominator + 1);\n assembly {\n // Divide denominator by twos.\n denominator := div(denominator, twos)\n\n // Divide [prod1 prod0] by twos.\n prod0 := div(prod0, twos)\n\n // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one.\n twos := add(div(sub(0, twos), twos), 1)\n }\n\n // Shift in bits from prod1 into prod0.\n prod0 |= prod1 * twos;\n\n // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such\n // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for\n // four bits. That is, denominator * inv = 1 mod 2^4.\n uint256 inverse = (3 * denominator) ^ 2;\n\n // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works\n // in modular arithmetic, doubling the correct bits in each step.\n inverse *= 2 - denominator * inverse; // inverse mod 2^8\n inverse *= 2 - denominator * inverse; // inverse mod 2^16\n inverse *= 2 - denominator * inverse; // inverse mod 2^32\n inverse *= 2 - denominator * inverse; // inverse mod 2^64\n inverse *= 2 - denominator * inverse; // inverse mod 2^128\n inverse *= 2 - denominator * inverse; // inverse mod 2^256\n\n // Because the division is now exact we can divide by multiplying with the modular inverse of denominator.\n // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is\n // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1\n // is no longer required.\n result = prod0 * inverse;\n return result;\n }\n }\n\n /**\n * @notice Calculates x * y / denominator with full precision, following the selected rounding direction.\n */\n function mulDiv(\n uint256 x,\n uint256 y,\n uint256 denominator,\n Rounding rounding\n ) internal pure returns (uint256) {\n uint256 result = mulDiv(x, y, denominator);\n if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) {\n result += 1;\n }\n return result;\n }\n\n /**\n * @dev Returns the square root of a number. It the number is not a perfect square, the value is rounded down.\n *\n * Inspired by Henry S. Warren, Jr.'s \"Hacker's Delight\" (Chapter 11).\n */\n function sqrt(uint256 a) internal pure returns (uint256) {\n if (a == 0) {\n return 0;\n }\n\n // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target.\n // We know that the \"msb\" (most significant bit) of our target number `a` is a power of 2 such that we have\n // `msb(a) <= a < 2*msb(a)`.\n // We also know that `k`, the position of the most significant bit, is such that `msb(a) = 2**k`.\n // This gives `2**k < a <= 2**(k+1)` → `2**(k/2) <= sqrt(a) < 2 ** (k/2+1)`.\n // Using an algorithm similar to the msb conmputation, we are able to compute `result = 2**(k/2)` which is a\n // good first aproximation of `sqrt(a)` with at least 1 correct bit.\n uint256 result = 1;\n uint256 x = a;\n if (x >> 128 > 0) {\n x >>= 128;\n result <<= 64;\n }\n if (x >> 64 > 0) {\n x >>= 64;\n result <<= 32;\n }\n if (x >> 32 > 0) {\n x >>= 32;\n result <<= 16;\n }\n if (x >> 16 > 0) {\n x >>= 16;\n result <<= 8;\n }\n if (x >> 8 > 0) {\n x >>= 8;\n result <<= 4;\n }\n if (x >> 4 > 0) {\n x >>= 4;\n result <<= 2;\n }\n if (x >> 2 > 0) {\n result <<= 1;\n }\n\n // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128,\n // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at\n // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision\n // into the expected uint128 result.\n unchecked {\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n result = (result + a / result) >> 1;\n return min(result, a / result);\n }\n }\n\n /**\n * @notice Calculates sqrt(a), following the selected rounding direction.\n */\n function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) {\n uint256 result = sqrt(a);\n if (rounding == Rounding.Up && result * result < a) {\n result += 1;\n }\n return result;\n }\n}\n" + }, + "@openzeppelin/contracts/utils/StorageSlot.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/StorageSlot.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Library for reading and writing primitive types to specific storage slots.\n *\n * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts.\n * This library helps with reading and writing to such slots without the need for inline assembly.\n *\n * The functions in this library return Slot structs that contain a `value` member that can be used to read or write.\n *\n * Example usage to set ERC1967 implementation slot:\n * ```\n * contract ERC1967 {\n * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc;\n *\n * function _getImplementation() internal view returns (address) {\n * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value;\n * }\n *\n * function _setImplementation(address newImplementation) internal {\n * require(Address.isContract(newImplementation), \"ERC1967: new implementation is not a contract\");\n * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation;\n * }\n * }\n * ```\n *\n * _Available since v4.1 for `address`, `bool`, `bytes32`, and `uint256`._\n */\nlibrary StorageSlot {\n struct AddressSlot {\n address value;\n }\n\n struct BooleanSlot {\n bool value;\n }\n\n struct Bytes32Slot {\n bytes32 value;\n }\n\n struct Uint256Slot {\n uint256 value;\n }\n\n /**\n * @dev Returns an `AddressSlot` with member `value` located at `slot`.\n */\n function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `BooleanSlot` with member `value` located at `slot`.\n */\n function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Bytes32Slot` with member `value` located at `slot`.\n */\n function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n\n /**\n * @dev Returns an `Uint256Slot` with member `value` located at `slot`.\n */\n function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) {\n /// @solidity memory-safe-assembly\n assembly {\n r.slot := slot\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Strings.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary Strings {\n bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n uint8 private constant _ADDRESS_LENGTH = 20;\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n */\n function toString(uint256 value) internal pure returns (string memory) {\n // Inspired by OraclizeAPI's implementation - MIT licence\n // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n if (value == 0) {\n return \"0\";\n }\n uint256 temp = value;\n uint256 digits;\n while (temp != 0) {\n digits++;\n temp /= 10;\n }\n bytes memory buffer = new bytes(digits);\n while (value != 0) {\n digits -= 1;\n buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n value /= 10;\n }\n return string(buffer);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n */\n function toHexString(uint256 value) internal pure returns (string memory) {\n if (value == 0) {\n return \"0x00\";\n }\n uint256 temp = value;\n uint256 length = 0;\n while (temp != 0) {\n length++;\n temp >>= 8;\n }\n return toHexString(value, length);\n }\n\n /**\n * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n */\n function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n bytes memory buffer = new bytes(2 * length + 2);\n buffer[0] = \"0\";\n buffer[1] = \"x\";\n for (uint256 i = 2 * length + 1; i > 1; --i) {\n buffer[i] = _HEX_SYMBOLS[value & 0xf];\n value >>= 4;\n }\n require(value == 0, \"Strings: hex length insufficient\");\n return string(buffer);\n }\n\n /**\n * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation.\n */\n function toHexString(address addr) internal pure returns (string memory) {\n return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH);\n }\n}\n" + }, + "contracts/BaseRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport \"./interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./interfaces/external/IWETH9.sol\";\nimport \"./interfaces/ICoreBorrow.sol\";\nimport \"./interfaces/IDepositWithReferral.sol\";\nimport \"./interfaces/ILiquidityGauge.sol\";\nimport \"./interfaces/ISwapper.sol\";\nimport \"./interfaces/IVaultManager.sol\";\n\n// ============================== STRUCTS AND ENUM =============================\n\n/// @notice Action types\nenum ActionType {\n transfer,\n wrapNative,\n unwrapNative,\n sweep,\n sweepNative,\n // Deprecated\n uniswapV3,\n oneInch,\n claimRewards,\n // Deprecated\n gaugeDeposit,\n borrower,\n swapper,\n mint4626,\n deposit4626,\n redeem4626,\n withdraw4626,\n // Deprecated\n prepareRedeemSavingsRate,\n // Deprecated\n claimRedeemSavingsRate,\n // Deprecated\n swapIn,\n // Deprecated\n swapOut,\n claimWeeklyInterest,\n // Deprecated\n withdraw,\n // Deprecated\n mint,\n // Deprecated\n deposit,\n // Deprecated\n openPerpetual,\n // Deprecated\n addToPerpetual,\n veANGLEDeposit,\n // Deprecated\n claimRewardsWithPerps,\n deposit4626Referral\n}\n\n/// @notice Data needed to get permits\nstruct PermitType {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @notice Data to grant permit to the router for a vault\nstruct PermitVaultManagerType {\n address vaultManager;\n address owner;\n bool approved;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @title BaseRouter\n/// @author Angle Core Team\n/// @notice Base contract that Angle router contracts on different chains should override\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\n using SafeERC20 for IERC20;\n\n // ================================= REFERENCES ================================\n\n /// @notice Core address handling access control\n ICoreBorrow public core;\n /// @notice Address of the router used for swaps\n IUniswapV3Router public uniswapV3Router;\n /// @notice Address of 1Inch router used for swaps\n address public oneInch;\n\n uint256[47] private __gap;\n\n // ============================== EVENTS / ERRORS ==============================\n\n error IncompatibleLengths();\n error InvalidReturnMessage();\n error NotApprovedOrOwner();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error TooSmallAmountOut();\n error TransferFailed();\n error ZeroAddress();\n\n event ReferredDeposit(\n address caller,\n address indexed owner,\n uint256 assets,\n uint256 shares,\n address indexed savings,\n address indexed referrer\n );\n\n /// @notice Deploys the router contract on a chain\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\n if (_core == address(0)) revert ZeroAddress();\n core = ICoreBorrow(_core);\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\n oneInch = _oneInch;\n }\n\n constructor() initializer {}\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @notice Allows composable calls to different functions within the protocol\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\n /// @param actions List of actions to be performed by the router (in order of execution)\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\n /// for a given action are stored\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\n /// do not perform a sweep action on these tokens\n function mixer(\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) public payable virtual {\n // If all tokens have already been approved, there's no need for this step\n uint256 permitsLength = paramsPermit.length;\n for (uint256 i; i < permitsLength; ++i) {\n IERC20Permit(paramsPermit[i].token).permit(\n paramsPermit[i].owner,\n address(this),\n paramsPermit[i].value,\n paramsPermit[i].deadline,\n paramsPermit[i].v,\n paramsPermit[i].r,\n paramsPermit[i].s\n );\n }\n // Performing actions one after the others\n uint256 actionsLength = actions.length;\n for (uint256 i; i < actionsLength; ++i) {\n if (actions[i] == ActionType.transfer) {\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\n } else if (actions[i] == ActionType.wrapNative) {\n _wrapNative();\n } else if (actions[i] == ActionType.unwrapNative) {\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\n _unwrapNative(minAmountOut, to);\n } else if (actions[i] == ActionType.sweep) {\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\n _sweep(tokenOut, minAmountOut, to);\n } else if (actions[i] == ActionType.sweepNative) {\n uint256 routerBalance = address(this).balance;\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\n } else if (actions[i] == ActionType.oneInch) {\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\n data[i],\n (address, uint256, bytes)\n );\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\n } else if (actions[i] == ActionType.claimRewards) {\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\n _claimRewards(user, claimLiquidityGauges);\n } else if (actions[i] == ActionType.borrower) {\n (\n address collateral,\n address vaultManager,\n address to,\n address who,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n bytes memory repayData\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\n } else if (actions[i] == ActionType.swapper) {\n (\n ISwapper swapperContract,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory payload\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\n } else if (actions[i] == ActionType.mint4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _mint4626(savingsRate, shares, to, maxAmountIn);\n } else if (actions[i] == ActionType.deposit4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626(savingsRate, amount, to, minSharesOut);\n } else if (actions[i] == ActionType.deposit4626Referral) {\n (\n IERC20 token,\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\n } else if (actions[i] == ActionType.redeem4626) {\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _redeem4626(savingsRate, shares, to, minAmountOut);\n } else if (actions[i] == ActionType.withdraw4626) {\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\n } else {\n _chainSpecificAction(actions[i], data[i]);\n }\n }\n }\n\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\n /// addresses depositing from a certain referring address into an ERC4626 contract\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n _changeAllowance(IERC20(token), savings, type(uint256).max);\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\n }\n\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\n /// actions and then revoking this approval after these actions\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\n /// to revoke approvals\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\n /// is just an option\n function mixerVaultManagerPermit(\n PermitVaultManagerType[] memory paramsPermitVaultManager,\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) external payable virtual {\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n true,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n } else break;\n }\n mixer(paramsPermit, actions, data);\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\n // too deep\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (!paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n false,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n }\n }\n }\n\n receive() external payable {}\n\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\n\n /// @notice Wraps the native token of a chain to its wrapped version\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\n /// @dev The amount to wrap is to be specified in the `msg.value`\n function _wrapNative() internal virtual returns (uint256) {\n _getNativeWrapper().deposit{ value: msg.value }();\n return msg.value;\n }\n\n /// @notice Unwraps the wrapped version of a token to the native chain token\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\n amount = _getNativeWrapper().balanceOf(address(this));\n _slippageCheck(amount, minAmountOut);\n if (amount != 0) {\n _getNativeWrapper().withdraw(amount);\n _safeTransferNative(to, amount);\n }\n return amount;\n }\n\n /// @notice Internal version of the `claimRewards` function\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\n uint256 gaugesLength = liquidityGauges.length;\n for (uint256 i; i < gaugesLength; ++i) {\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\n }\n }\n\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\n /// @param vaultManager Address of the vault to perform actions on\n /// @param actionsBorrow Actions type to perform on the vaultManager\n /// @param dataBorrow Data needed for each actions\n /// @param to Address to send the funds to\n /// @param who Swapper address to handle repayments\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\n function _angleBorrower(\n address vaultManager,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address to,\n address who,\n bytes memory repayData\n ) internal virtual returns (PaymentData memory paymentData) {\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\n }\n\n /// @notice Sweeps tokens from the router contract\n /// @param tokenOut Token to sweep\n /// @param minAmountOut Minimum amount of tokens to recover\n /// @param to Address to which tokens should be sent\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\n _slippageCheck(balanceToken, minAmountOut);\n if (balanceToken != 0) {\n IERC20(tokenOut).safeTransfer(to, balanceToken);\n }\n }\n\n /// @notice Uses an external swapper\n /// @param swapper Contracts implementing the logic of the swap\n /// @param inToken Token used to do the swap\n /// @param outToken Token wanted\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\n /// @param inTokenObtained Amount of `inToken` used for the swap\n /// @param data Additional info for the specific swapper\n function _swapper(\n ISwapper swapper,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) internal {\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\n }\n\n /// @notice Swaps an inToken to another token via 1Inch Router\n /// @param payload Bytes needed for 1Inch router to process the swap\n /// @dev The `payload` given is expected to be obtained from 1Inch API\n function _swapOn1Inch(\n IERC20 inToken,\n uint256 minAmountOut,\n bytes memory payload\n ) internal returns (uint256 amountOut) {\n // Approve transfer to the `oneInch` address\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\n address oneInchRouter = oneInch;\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\n //solhint-disable-next-line\n (bool success, bytes memory result) = oneInchRouter.call(payload);\n if (!success) _revertBytes(result);\n\n amountOut = abi.decode(result, (uint256));\n _slippageCheck(amountOut, minAmountOut);\n }\n\n /// @notice Mints `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to mint shares from\n /// @param shares Amount of shares to mint from the contract\n /// @param to Address to which shares should be sent\n /// @param maxAmountIn Max amount of assets used to mint\n /// @return amountIn Amount of assets used to mint by `to`\n function _mint4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 maxAmountIn\n ) internal returns (uint256 amountIn) {\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\n }\n\n /// @notice Deposits `amount` to an ERC4626 contract\n /// @param savingsRate The ERC4626 to deposit assets to\n /// @param amount Amount of assets to deposit\n /// @param to Address to which shares should be sent\n /// @param minSharesOut Minimum amount of shares that `to` should received\n /// @return sharesOut Amount of shares received by `to`\n function _deposit4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\n }\n\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\n function _deposit4626Referral(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) internal returns (uint256 sharesOut) {\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\n }\n\n /// @notice Withdraws `amount` from an ERC4626 contract\n /// @param savingsRate ERC4626 to withdraw assets from\n /// @param amount Amount of assets to withdraw\n /// @param to Destination of assets\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\n /// @return sharesOut Amount of shares burnt\n function _withdraw4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 maxSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\n }\n\n /// @notice Redeems `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to redeem shares from\n /// @param shares Amount of shares to redeem\n /// @param to Destination of assets\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\n /// @return amountOut Amount of assets received by `to`\n function _redeem4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 minAmountOut\n ) internal returns (uint256 amountOut) {\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\n }\n\n /// @notice Allows to perform some specific actions for a chain\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\n\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\n\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\n\n // ============================ GOVERNANCE FUNCTION ============================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Sets a new `core` contract\n function setCore(ICoreBorrow _core) external {\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\n core = ICoreBorrow(_core);\n }\n\n /// @notice Changes allowances for different tokens\n /// @param tokens Addresses of the tokens to allow\n /// @param spenders Addresses to allow transfer\n /// @param amounts Amounts to allow\n function changeAllowance(\n IERC20[] calldata tokens,\n address[] calldata spenders,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\n for (uint256 i; i < tokensLength; ++i) {\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\n }\n }\n\n /// @notice Sets a new router variable\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\n if (router == address(0)) revert ZeroAddress();\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\n else oneInch = router;\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Changes allowance of this contract for a given token\n /// @param token Address of the token to change allowance\n /// @param spender Address to change the allowance of\n /// @param amount Amount allowed\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\n uint256 currentAllowance = token.allowance(address(this), spender);\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\n } else if (currentAllowance > amount) {\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\n }\n }\n\n /// @notice Transfer amount of the native token to the `to` address\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\n function _safeTransferNative(address to, uint256 amount) internal {\n bool success;\n //solhint-disable-next-line\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) revert TransferFailed();\n }\n\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\n /// the calling address is well approved for all the vaults with which it is interacting\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\n /// with a vault are approved for this vault\n function _parseVaultIDs(\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address vaultManager,\n address collateral\n ) internal view returns (bytes[] memory) {\n uint256 actionsBorrowLength = actionsBorrow.length;\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\n bool createVaultAction;\n uint256 lastVaultID;\n uint256 vaultIDLength;\n for (uint256 i; i < actionsBorrowLength; ++i) {\n uint256 vaultID;\n // If there is a `createVault` action, the router should not worry about looking at\n // next vaultIDs given equal to 0\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\n createVaultAction = true;\n continue;\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\n // as collateral the full contract balance\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\n uint256 amount;\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\n if (amount == type(uint256).max)\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\n continue;\n // There are different ways depending on the action to find the `vaultID` to parse\n } else if (\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\n ) {\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\n vaultID = abi.decode(dataBorrow[i], (uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\n } else continue;\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\n // if there has not been any specific action\n if (vaultID == 0) {\n if (createVaultAction) {\n continue;\n } else {\n // If we haven't stored the last `vaultID`, we need to fetch it\n if (lastVaultID == 0) {\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\n }\n vaultID = lastVaultID;\n }\n }\n\n // Check if this `vaultID` has already been verified\n for (uint256 j; j < vaultIDLength; ++j) {\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\n // If yes, we continue to the next iteration\n continue;\n }\n }\n // Verify this new `vaultID` and add it to the list\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\n revert NotApprovedOrOwner();\n }\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\n vaultIDLength += 1;\n }\n return dataBorrow;\n }\n\n /// @notice Checks whether the amount obtained during a swap is not too small\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\n if (amount < thresholdAmount) revert TooSmallAmountOut();\n }\n\n /// @notice Internal function used for error handling\n function _revertBytes(bytes memory errMsg) internal pure {\n if (errMsg.length != 0) {\n //solhint-disable-next-line\n assembly {\n revert(add(32, errMsg), mload(errMsg))\n }\n }\n revert InvalidReturnMessage();\n }\n}\n" + }, + "contracts/external/ProxyAdmin.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./TransparentUpgradeableProxy.sol\";\nimport \"@openzeppelin/contracts/access/Ownable.sol\";\n\n/**\n * @dev This is an auxiliary contract meant to be assigned as the admin of a {TransparentUpgradeableProxy}. For an\n * explanation of why you would want to use this see the documentation for {TransparentUpgradeableProxy}.\n * This contract was fully forked from OpenZeppelin `ProxyAdmin`\n */\ncontract ProxyAdmin is Ownable {\n /**\n * @dev Returns the current implementation of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyImplementation(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"implementation()\")) == 0x5c60da1b\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"5c60da1b\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Returns the current admin of `proxy`.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function getProxyAdmin(TransparentUpgradeableProxy proxy) public view virtual returns (address) {\n // We need to manually run the static call since the getter cannot be flagged as view\n // bytes4(keccak256(\"admin()\")) == 0xf851a440\n (bool success, bytes memory returndata) = address(proxy).staticcall(hex\"f851a440\");\n require(success);\n return abi.decode(returndata, (address));\n }\n\n /**\n * @dev Changes the admin of `proxy` to `newAdmin`.\n *\n * Requirements:\n *\n * - This contract must be the current admin of `proxy`.\n */\n function changeProxyAdmin(TransparentUpgradeableProxy proxy, address newAdmin) public virtual onlyOwner {\n proxy.changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation`. See {TransparentUpgradeableProxy-upgradeTo}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgrade(TransparentUpgradeableProxy proxy, address implementation) public virtual onlyOwner {\n proxy.upgradeTo(implementation);\n }\n\n /**\n * @dev Upgrades `proxy` to `implementation` and calls a function on the new implementation. See\n * {TransparentUpgradeableProxy-upgradeToAndCall}.\n *\n * Requirements:\n *\n * - This contract must be the admin of `proxy`.\n */\n function upgradeAndCall(\n TransparentUpgradeableProxy proxy,\n address implementation,\n bytes memory data\n ) public payable virtual onlyOwner {\n proxy.upgradeToAndCall{ value: msg.value }(implementation, data);\n }\n}\n" + }, + "contracts/external/TransparentUpgradeableProxy.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol\";\n\n/**\n * @dev This contract implements a proxy that is upgradeable by an admin. It is fully forked from OpenZeppelin\n * `TransparentUpgradeableProxy`\n *\n * To avoid https://medium.com/nomic-labs-blog/malicious-backdoors-in-ethereum-proxies-62629adf3357[proxy selector\n * clashing], which can potentially be used in an attack, this contract uses the\n * https://blog.openzeppelin.com/the-transparent-proxy-pattern/[transparent proxy pattern]. This pattern implies two\n * things that go hand in hand:\n *\n * 1. If any account other than the admin calls the proxy, the call will be forwarded to the implementation, even if\n * that call matches one of the admin functions exposed by the proxy itself.\n * 2. If the admin calls the proxy, it can access the admin functions, but its calls will never be forwarded to the\n * implementation. If the admin tries to call a function on the implementation it will fail with an error that says\n * \"admin cannot fallback to proxy target\".\n *\n * These properties mean that the admin account can only be used for admin actions like upgrading the proxy or changing\n * the admin, so it's best if it's a dedicated account that is not used for anything else. This will avoid headaches due\n * to sudden errors when trying to call a function from the proxy implementation.\n *\n * Our recommendation is for the dedicated account to be an instance of the {ProxyAdmin} contract. If set up this way,\n * you should think of the `ProxyAdmin` instance as the real administrative interface of your proxy.\n */\ncontract TransparentUpgradeableProxy is ERC1967Proxy {\n /**\n * @dev Initializes an upgradeable proxy managed by `_admin`, backed by the implementation at `_logic`, and\n * optionally initialized with `_data` as explained in {ERC1967Proxy-constructor}.\n */\n constructor(\n address _logic,\n address admin_,\n bytes memory _data\n ) payable ERC1967Proxy(_logic, _data) {\n assert(_ADMIN_SLOT == bytes32(uint256(keccak256(\"eip1967.proxy.admin\")) - 1));\n _changeAdmin(admin_);\n }\n\n /**\n * @dev Modifier used internally that will delegate the call to the implementation unless the sender is the admin.\n */\n modifier ifAdmin() {\n if (msg.sender == _getAdmin()) {\n _;\n } else {\n _fallback();\n }\n }\n\n /**\n * @dev Returns the current admin.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyAdmin}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103`\n */\n function admin() external ifAdmin returns (address admin_) {\n admin_ = _getAdmin();\n }\n\n /**\n * @dev Returns the current implementation.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-getProxyImplementation}.\n *\n * TIP: To get this value clients can read directly from the storage slot shown below (specified by EIP1967) using the\n * https://eth.wiki/json-rpc/API#eth_getstorageat[`eth_getStorageAt`] RPC call.\n * `0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc`\n */\n function implementation() external ifAdmin returns (address implementation_) {\n implementation_ = _implementation();\n }\n\n /**\n * @dev Changes the admin of the proxy.\n *\n * Emits an {AdminChanged} event.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-changeProxyAdmin}.\n */\n function changeAdmin(address newAdmin) external virtual ifAdmin {\n _changeAdmin(newAdmin);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgrade}.\n */\n function upgradeTo(address newImplementation) external ifAdmin {\n _upgradeToAndCall(newImplementation, bytes(\"\"), false);\n }\n\n /**\n * @dev Upgrade the implementation of the proxy, and then call a function from the new implementation as specified\n * by `data`, which should be an encoded function call. This is useful to initialize new storage variables in the\n * proxied contract.\n *\n * NOTE: Only the admin can call this function. See {ProxyAdmin-upgradeAndCall}.\n */\n function upgradeToAndCall(address newImplementation, bytes calldata data) external payable ifAdmin {\n _upgradeToAndCall(newImplementation, data, true);\n }\n\n /**\n * @dev Returns the current admin.\n */\n function _admin() internal view virtual returns (address) {\n return _getAdmin();\n }\n\n /**\n * @dev Makes sure the admin cannot access the fallback function. See {Proxy-_beforeFallback}.\n */\n function _beforeFallback() internal virtual override {\n require(msg.sender != _getAdmin(), \"TransparentUpgradeableProxy: admin cannot fallback to proxy target\");\n super._beforeFallback();\n }\n}\n" + }, + "contracts/implementations/arbitrum/AngleRouterArbitrum.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterArbitrum\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\ncontract AngleRouterArbitrum is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n }\n}\n" + }, + "contracts/implementations/avalanche/AngleRouterAvalanche.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterAvalanche\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Avalanche\ncontract AngleRouterAvalanche is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n }\n}\n" + }, + "contracts/implementations/base/AngleRouterBase.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterBase\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Base\ncontract AngleRouterBase is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/celo/AngleRouterCelo.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterCelo\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Celo\ncontract AngleRouterCelo is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0000000000000000000000000000000000000000);\n }\n}\n" + }, + "contracts/implementations/gnosis/AngleRouterGnosis.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterGnosis\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Gnosis\ncontract AngleRouterGnosis is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n }\n}\n" + }, + "contracts/implementations/linea/AngleRouterLinea.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterLinea\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Linea\ncontract AngleRouterLinea is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f);\n }\n}\n" + }, + "contracts/implementations/mainnet/AngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../interfaces/IFeeDistributorFront.sol\";\nimport \"../../interfaces/ISanToken.sol\";\nimport \"../../interfaces/IStableMasterFront.sol\";\nimport \"../../interfaces/IVeANGLE.sol\";\n\nimport \"../../BaseRouter.sol\";\n\n// ============================= STRUCTS AND ENUMS =============================\n\n/// @notice References to the contracts associated to a collateral for a stablecoin\nstruct Pairs {\n IPoolManager poolManager;\n IPerpetualManagerFrontWithClaim perpetualManager;\n ISanToken sanToken;\n ILiquidityGauge gauge;\n}\n\n/// @title AngleRouterMainnet\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Ethereum\n/// @dev Previous implementation with an initialization function can be found here:\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\ncontract AngleRouterMainnet is BaseRouter {\n using SafeERC20 for IERC20;\n\n // =================================== ERRORS ==================================\n\n error InvalidParams();\n\n // ================================== MAPPINGS =================================\n\n /// @notice Maps an agToken to its counterpart `StableMaster`\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\n\n uint256[48] private __gapMainnet;\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @inheritdoc BaseRouter\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\n if (action == ActionType.claimWeeklyInterest) {\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\n } else if (action == ActionType.veANGLEDeposit) {\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\n _depositOnLocker(user, amount);\n }\n }\n\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n }\n\n /// @notice Deposits ANGLE on an existing locker\n /// @param user Address to deposit for\n /// @param amount Amount to deposit\n function _depositOnLocker(address user, uint256 amount) internal {\n _getVeANGLE().deposit_for(user, amount);\n }\n\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\n /// @param user Address to claim for\n /// @param _feeDistributor Address of the fee distributor to claim to\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\n /// transfer the token claimed from the `feeDistributor`\n function _claimWeeklyInterest(\n address user,\n IFeeDistributorFront _feeDistributor,\n bool letInContract\n ) internal {\n uint256 amount = _feeDistributor.claim(user);\n if (letInContract) {\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\n IERC20 token = IERC20(_feeDistributor.token());\n token.safeTransferFrom(msg.sender, address(this), amount);\n }\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Returns the veANGLE address\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\n }\n}\n" + }, + "contracts/implementations/optimism/AngleRouterOptimism.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterOptimism\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Optimism\ncontract AngleRouterOptimism is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/polygon/AngleRouterPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterPolygon\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Polygon\ncontract AngleRouterPolygon is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n }\n}\n" + }, + "contracts/interfaces/external/IERC1271.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\n/// @title Interface for verifying contract-based account signatures\n/// @notice Interface that verifies provided signature for the data\n/// @dev Interface defined by EIP-1271\ninterface IERC1271 {\n /// @notice Returns whether the provided signature is valid for the provided data\n /// @dev MUST return the bytes4 magic value 0x1626ba7e when function passes.\n /// MUST NOT modify state (using STATICCALL for solc < 0.5, view modifier for solc > 0.5).\n /// MUST allow external calls.\n /// @param hash Hash of the data to be signed\n /// @param signature Signature byte array associated with _data\n /// @return magicValue The bytes4 magic value 0x1626ba7e\n function isValidSignature(bytes32 hash, bytes memory signature) external view returns (bytes4 magicValue);\n}\n" + }, + "contracts/interfaces/external/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "contracts/interfaces/external/lido/ISteth.sol": { + "content": "// SPDX-License-Identifier: MIT\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ninterface IStETH is IERC20 {\n event Submitted(address sender, uint256 amount, address referral);\n\n function submit(address) external payable returns (uint256);\n\n function getSharesByPooledEth(uint256 _ethAmount) external view returns (uint256);\n}\n" + }, + "contracts/interfaces/external/lido/IWStETH.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title IWStETH\n/// @author Angle Core Team\n/// @notice Interface for the `WStETH` contract\n/// @dev This interface only contains functions of the `WStETH` which are called by other contracts\n/// of this module\ninterface IWStETH is IERC20 {\n function stETH() external returns (address);\n\n function wrap(uint256 _stETHAmount) external returns (uint256);\n\n function unwrap(uint256 _wstETHAmount) external returns (uint256);\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nstruct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n}\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IUniswapV3Router {\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n\n/// @title Router for price estimation functionality\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\n/// @dev This interface is only used for non critical elements of the protocol\ninterface IUniswapV2Router {\n /// @notice Given an input asset amount, returns the maximum output amount of the\n /// other asset (accounting for fees) given reserves.\n /// @param path Addresses of the pools used to get prices\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokens(\n uint256 swapAmount,\n uint256 minExpected,\n address[] calldata path,\n address receiver,\n uint256 swapDeadline\n ) external;\n}\n" + }, + "contracts/interfaces/IAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IAgToken\n/// @author Angle Core Team\n/// @notice Interface for the stablecoins `AgToken` contracts\n/// @dev The only functions that are left in the interface are the functions which are used\n/// at another point in the protocol by a different contract\ninterface IAgToken is IERC20Upgradeable {\n // ======================= `StableMaster` functions ============================\n function mint(address account, uint256 amount) external;\n\n function burnFrom(\n uint256 amount,\n address burner,\n address sender\n ) external;\n\n function burnSelf(uint256 amount, address burner) external;\n\n // ========================= External function =================================\n\n function stableMaster() external view returns (address);\n}\n" + }, + "contracts/interfaces/IAgTokenMultiChain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IAgTokenMultiChain\n/// @author Angle Core Team\n/// @notice Interface for the stablecoins `AgToken` contracts in multiple chains\ninterface IAgTokenMultiChain {\n function swapIn(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256);\n\n function swapOut(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256);\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICoreBorrow\n/// @author Angle Core Team\n/// @notice Interface for the `CoreBorrow` contract\n\ninterface ICoreBorrow {\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IDepositWithReferral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title IDepositWithReferral\n/// @author Angle Core Team\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\ninterface IDepositWithReferral {\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\n /// obtained, the function reverts\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\n /// when a deposit takes place\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut);\n}\n" + }, + "contracts/interfaces/IFeeDistributorFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IFeeDistributorFront\n/// @author Interface for public use of the `FeeDistributor` contract\n/// @dev This interface is used for user related function\ninterface IFeeDistributorFront {\n function token() external returns (address);\n\n function claim(address _addr) external returns (uint256);\n\n function claim(address[20] memory _addr) external returns (bool);\n}\n" + }, + "contracts/interfaces/ILiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function staking_token() external returns (address stakingToken);\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external;\n}\n" + }, + "contracts/interfaces/IPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title Interface of the contract managing perpetuals with claim function\n/// @author Angle Core Team\n/// @dev Front interface with rewards function, meaning only user-facing functions\ninterface IPerpetualManagerFrontWithClaim {\n function getReward(uint256 perpetualID) external;\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\n\n function openPerpetual(\n address owner,\n uint256 amountBrought,\n uint256 amountCommitted,\n uint256 maxOracleRate,\n uint256 minNetMargin\n ) external returns (uint256 perpetualID);\n}\n" + }, + "contracts/interfaces/IPoolManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IPoolManager {\n function token() external view returns (address);\n}\n" + }, + "contracts/interfaces/ISanToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ISanToken is IERC20Upgradeable {}\n" + }, + "contracts/interfaces/IStableMasterFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IPoolManager.sol\";\nimport \"./ISanToken.sol\";\nimport \"./IPerpetualManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Struct to handle all the parameters to manage the fees\n// related to a given collateral pool (associated to the stablecoin)\nstruct MintBurnData {\n // Values of the thresholds to compute the minting fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeMint;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeMint;\n // Values of the thresholds to compute the burning fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeBurn;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeBurn;\n // Max proportion of collateral from users that can be covered by HAs\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\n // the other changes accordingly\n uint64 targetHAHedge;\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusMint;\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusBurn;\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\n uint256 capOnStableMinted;\n}\n\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\n// including the fraction of interests they receive or the fees to be distributed to\n// them\nstruct SLPData {\n // Last timestamp at which the `sanRate` has been updated for SLPs\n uint256 lastBlockUpdated;\n // Fees accumulated from previous blocks and to be distributed to SLPs\n uint256 lockedInterests;\n // Max interests used to update the `sanRate` in a single block\n // Should be in collateral token base\n uint256 maxInterestsDistributed;\n // Amount of fees left aside for SLPs and that will be distributed\n // when the protocol is collateralized back again\n uint256 feesAside;\n // Part of the fees normally going to SLPs that is left aside\n // before the protocol is collateralized back again (depends on collateral ratio)\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippageFee;\n // Portion of the fees from users minting and burning\n // that goes to SLPs (the rest goes to surplus)\n uint64 feesForSLPs;\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippage;\n // Portion of the interests from lending\n // that goes to SLPs (the rest goes to surplus)\n uint64 interestsForSLPs;\n}\n\n/// @title IStableMasterFront\n/// @author Angle Core Team\n/// @dev Front interface, meaning only user-facing functions\ninterface IStableMasterFront {\n function collateralMap(IPoolManager poolManager)\n external\n view\n returns (\n IERC20 token,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n address oracle,\n uint256 stocksUsers,\n uint256 sanRate,\n uint256 collatBase,\n SLPData memory slpData,\n MintBurnData memory feeData\n );\n\n function updateStocksUsers(uint256 amount, address poolManager) external;\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256 minStableAmount\n ) external;\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256 minCollatAmount\n ) external;\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external;\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external;\n\n function agToken() external returns (address);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Core Team\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\ninterface ISwapper {\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager``\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\n uint256 normalizedDebt;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionBorrowType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IVeANGLE\n/// @author Angle Core Team\n/// @notice Interface for the `VeANGLE` contract\ninterface IVeANGLE {\n // solhint-disable-next-line func-name-mixedcase\n function deposit_for(address addr, uint256 amount) external;\n}\n" + }, + "contracts/mock/Mock1Inch.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\nimport \"./MockTokenPermit.sol\";\n\nstruct SwapDescription {\n IERC20 srcToken;\n IERC20 dstToken;\n address payable srcReceiver;\n address payable dstReceiver;\n uint256 amount;\n uint256 minReturnAmount;\n uint256 flags;\n bytes permit;\n}\n\n// File contracts/interfaces/IAggregationExecutor.sol\n/// @title Interface for making arbitrary calls during swap\ninterface IAggregationExecutor {\n /// @notice Make calls on `msgSender` with specified data\n function callBytes(address msgSender, bytes calldata data) external payable; // 0x2636f7f8\n}\n\n// @notice mock contract to swap token\ncontract Mock1Inch {\n uint256 public exchangeRate = 1 ether;\n IERC20Metadata public tokenA;\n IERC20Metadata public tokenB;\n uint256 public decimalsA;\n uint256 public decimalsB;\n\n constructor(IERC20Metadata _tokenA, IERC20Metadata _tokenB) {\n tokenA = _tokenA;\n tokenB = _tokenB;\n decimalsA = _tokenA.decimals();\n decimalsB = _tokenB.decimals();\n MockTokenPermit(address(tokenB)).mint(address(this), type(uint256).max / 1000);\n }\n\n function swap(\n IAggregationExecutor caller,\n SwapDescription calldata desc,\n bytes calldata data\n )\n external\n payable\n returns (\n uint256 returnAmount,\n uint256 spentAmount,\n uint256 gasLeft\n )\n {\n caller;\n data;\n spentAmount;\n gasLeft;\n tokenA.transferFrom(msg.sender, address(this), desc.amount);\n returnAmount = (((desc.amount * exchangeRate) / 1 ether) * 10**decimalsB) / 10**decimalsA;\n tokenB.transfer(msg.sender, returnAmount);\n }\n\n function unsupportedSwap() external payable returns (address returnAmount) {\n return address(this);\n }\n\n function revertingSwap() external payable {\n revert(\"wrong swap\");\n }\n\n function updateExchangeRate(uint256 newExchangeRate) external {\n exchangeRate = newExchangeRate;\n }\n}\n" + }, + "contracts/mock/MockAgToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../interfaces/IAgToken.sol\";\nimport \"../interfaces/IStableMasterFront.sol\";\nimport \"../interfaces/ITreasury.sol\";\n// OpenZeppelin may update its version of the ERC20PermitUpgradeable token\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-ERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/// @title AgToken\n/// @author Angle Core Team\n/// @notice Base contract for agToken, that is to say Angle's stablecoins\n/// @dev This contract is used to create and handle the stablecoins of Angle protocol\n/// @dev It is still possible for any address to burn its agTokens without redeeming collateral in exchange\n/// @dev This contract is the upgraded version of the AgToken that was first deployed on Ethereum mainnet\ncontract MockAgToken is IAgToken, ERC20PermitUpgradeable {\n using SafeERC20 for IERC20;\n // ========================= References to other contracts =====================\n\n /// @notice Reference to the `StableMaster` contract associated to this `AgToken`\n address public override stableMaster;\n uint256 public inFees;\n uint256 public outFees;\n uint256 public constant BASE_PARAMS = 10**9;\n\n // ============================= Constructor ===================================\n\n /// @notice Initializes the `AgToken` contract\n /// @param name_ Name of the token\n /// @param symbol_ Symbol of the token\n /// @param stableMaster_ Reference to the `StableMaster` contract associated to this agToken\n /// @dev By default, agTokens are ERC-20 tokens with 18 decimals\n function initialize(\n string memory name_,\n string memory symbol_,\n address stableMaster_,\n ITreasury _treasury\n ) external initializer {\n __ERC20Permit_init(name_);\n __ERC20_init(name_, symbol_);\n stableMaster = stableMaster_;\n treasury = _treasury;\n isMinter[stableMaster] = true;\n }\n\n /// @custom:oz-upgrades-unsafe-allow constructor\n constructor() initializer {}\n\n // ======= Added Parameters and Variables from the first implementation ========\n\n mapping(address => bool) public isMinter;\n /// @notice Reference to the treasury contract which can grant minting rights\n ITreasury public treasury;\n\n // =============================== Added Events ================================\n\n event TreasuryUpdated(address indexed _treasury);\n event MinterToggled(address indexed minter);\n\n // =============================== Modifiers ===================================\n\n /// @notice Checks to see if it is the `StableMaster` calling this contract\n /// @dev There is no Access Control here, because it can be handled cheaply through this modifier\n modifier onlyTreasury() {\n require(msg.sender == address(treasury), \"1\");\n _;\n }\n\n /// @notice Checks whether the sender has the minting right\n modifier onlyMinter() {\n require(isMinter[msg.sender], \"35\");\n _;\n }\n\n // ========================= External Functions ================================\n // The following functions allow anyone to burn stablecoins without redeeming collateral\n // in exchange for that\n\n /// @notice Destroys `amount` token from the caller without giving collateral back\n /// @param amount Amount to burn\n /// @param poolManager Reference to the `PoolManager` contract for which the `stocksUsers` will\n /// need to be updated\n /// @dev When calling this function, people should specify the `poolManager` for which they want to decrease\n /// the `stocksUsers`: this a way for the protocol to maintain healthy accounting variables\n function burnNoRedeem(uint256 amount, address poolManager) external {\n _burn(msg.sender, amount);\n IStableMasterFront(stableMaster).updateStocksUsers(amount, poolManager);\n }\n\n /// @notice Burns `amount` of agToken on behalf of another account without redeeming collateral back\n /// @param account Account to burn on behalf of\n /// @param amount Amount to burn\n /// @param poolManager Reference to the `PoolManager` contract for which the `stocksUsers` will need to be updated\n function burnFromNoRedeem(\n address account,\n uint256 amount,\n address poolManager\n ) external {\n _burnFromNoRedeem(amount, account, msg.sender);\n IStableMasterFront(stableMaster).updateStocksUsers(amount, poolManager);\n }\n\n /// @notice Allows anyone to burn agToken without redeeming collateral back\n /// @param amount Amount of stablecoins to burn\n /// @dev This function can typically be called if there is a settlement mechanism to burn stablecoins\n function burnStablecoin(uint256 amount) external {\n _burn(msg.sender, amount);\n }\n\n // ======================= Minter Role Only Functions ==========================\n\n /// @inheritdoc IAgToken\n function burnSelf(uint256 amount, address burner) external override {\n _burn(burner, amount);\n }\n\n /// @inheritdoc IAgToken\n function burnFrom(\n uint256 amount,\n address burner,\n address sender\n ) external override onlyMinter {\n _burnFromNoRedeem(amount, burner, sender);\n }\n\n /// @inheritdoc IAgToken\n function mint(address account, uint256 amount) external override {\n _mint(account, amount);\n }\n\n // ======================= Treasury Only Functions =============================\n\n function addMinter(address minter) external {\n isMinter[minter] = true;\n emit MinterToggled(minter);\n }\n\n function removeMinter(address minter) external {\n // The `treasury` contract cannot remove the `stableMaster`\n require((msg.sender == address(treasury) && minter != stableMaster) || msg.sender == minter, \"36\");\n isMinter[minter] = false;\n emit MinterToggled(minter);\n }\n\n function setTreasury(address _treasury) external onlyTreasury {\n treasury = ITreasury(_treasury);\n emit TreasuryUpdated(_treasury);\n }\n\n // ============================ Internal Function ==============================\n\n /// @notice Internal version of the function `burnFromNoRedeem`\n /// @param amount Amount to burn\n /// @dev It is at the level of this function that allowance checks are performed\n function _burnFromNoRedeem(\n uint256 amount,\n address burner,\n address sender\n ) internal {\n if (burner != sender) {\n uint256 currentAllowance = allowance(burner, sender);\n require(currentAllowance >= amount, \"23\");\n _approve(burner, sender, currentAllowance - amount);\n }\n _burn(burner, amount);\n }\n\n function swapIn(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256) {\n IERC20(bridgeToken).safeTransferFrom(msg.sender, address(this), amount);\n uint256 canonicalOut = (amount * (BASE_PARAMS - inFees)) / BASE_PARAMS;\n _mint(to, canonicalOut);\n return canonicalOut;\n }\n\n function swapOut(\n address bridgeToken,\n uint256 amount,\n address to\n ) external returns (uint256) {\n _burn(msg.sender, amount);\n uint256 bridgeOut = (amount * (BASE_PARAMS - outFees)) / BASE_PARAMS;\n\n IERC20(bridgeToken).safeTransfer(to, bridgeOut);\n return bridgeOut;\n }\n\n function setFees(uint256 _inFees, uint256 _outFees) external {\n inFees = _inFees;\n outFees = _outFees;\n }\n}\n" + }, + "contracts/mock/MockAngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../implementations/mainnet/AngleRouterMainnet.sol\";\n\ncontract MockAngleRouterMainnet is AngleRouterMainnet {\n address public veAngle;\n\n function setAngleAndVeANGLE(address _veAngle) external {\n veAngle = _veAngle;\n }\n\n function _getVeANGLE() internal view override returns (IVeANGLE) {\n return IVeANGLE(veAngle);\n }\n\n function addStableMaster(IERC20 stablecoin, IStableMasterFront stableMaster) external {\n mapStableMasters[stablecoin] = stableMaster;\n }\n\n function addPairs(\n IERC20[] calldata stablecoins,\n IPoolManager[] calldata poolManagers,\n ILiquidityGauge[] calldata liquidityGauges,\n bool[] calldata justLiquidityGauges\n ) external {\n for (uint256 i; i < stablecoins.length; ++i) {\n IStableMasterFront stableMaster = mapStableMasters[stablecoins[i]];\n _addPair(stableMaster, poolManagers[i], liquidityGauges[i], justLiquidityGauges[i]);\n }\n }\n\n function _addPair(\n IStableMasterFront stableMaster,\n IPoolManager poolManager,\n ILiquidityGauge liquidityGauge,\n bool justLiquidityGauge\n ) internal {\n // Fetching the associated `sanToken` and `perpetualManager` from the contract\n (\n IERC20 collateral,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n ,\n ,\n ,\n ,\n ,\n\n ) = stableMaster.collateralMap(poolManager);\n // Reverting if the poolManager is not a valid `poolManager`\n if (address(collateral) == address(0)) revert InvalidParams();\n Pairs storage _pairs = mapPoolManagers[stableMaster][collateral];\n if (justLiquidityGauge) {\n // Cannot specify a liquidity gauge if the associated poolManager does not exist\n if (address(_pairs.poolManager) == address(0)) revert ZeroAddress();\n ILiquidityGauge gauge = _pairs.gauge;\n if (address(gauge) != address(0)) {\n _changeAllowance(IERC20(address(sanToken)), address(gauge), 0);\n }\n } else {\n // Checking if the pair has not already been initialized: if yes we need to make the function revert\n // otherwise we could end up with still approved `PoolManager` and `PerpetualManager` contracts\n if (address(_pairs.poolManager) != address(0)) revert InvalidParams();\n _pairs.poolManager = poolManager;\n _pairs.perpetualManager = IPerpetualManagerFrontWithClaim(address(perpetualManager));\n _pairs.sanToken = sanToken;\n _changeAllowance(collateral, address(stableMaster), type(uint256).max);\n _changeAllowance(collateral, address(perpetualManager), type(uint256).max);\n }\n _pairs.gauge = liquidityGauge;\n if (address(liquidityGauge) != address(0)) {\n if (address(sanToken) != liquidityGauge.staking_token()) revert InvalidParams();\n _changeAllowance(IERC20(address(sanToken)), address(liquidityGauge), type(uint256).max);\n }\n }\n}\n\ncontract MockAngleRouterMainnet2 is AngleRouterMainnet {\n function getVeANGLE() external view returns (IVeANGLE) {\n return _getVeANGLE();\n }\n}\n" + }, + "contracts/mock/MockBorrowStaker.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ncontract MockBorrowStaker {\n mapping(address => uint256) public counter;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external returns (uint256[] memory) {\n _addr;\n counter[_addr] += 1;\n uint256[] memory returnValue = new uint256[](2);\n returnValue[0] = 1;\n returnValue[1] = 2;\n return returnValue;\n }\n}\n" + }, + "contracts/mock/MockCoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ncontract MockCoreBorrow {\n mapping(address => bool) public governors;\n mapping(address => bool) public guardians;\n\n function isGovernor(address admin) external view returns (bool) {\n return governors[admin];\n }\n\n function isGovernorOrGuardian(address admin) external view returns (bool) {\n return guardians[admin];\n }\n\n function toggleGovernor(address admin) external {\n governors[admin] = !governors[admin];\n }\n\n function toggleGuardian(address admin) external {\n guardians[admin] = !guardians[admin];\n }\n}\n" + }, + "contracts/mock/MockERC4626.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol\";\n\ncontract MockERC4626 is ERC4626 {\n constructor(\n IERC20Metadata asset_,\n string memory name_,\n string memory symbol_\n ) ERC4626(asset_) ERC20(name_, symbol_) {}\n}\n" + }, + "contracts/mock/MockFeeDistributor.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\ncontract MockFeeDistributor {\n using SafeERC20 for IERC20;\n\n address public token;\n\n constructor() {}\n\n function claim(address user) external returns (uint256 amount) {\n amount = IERC20(token).balanceOf(address(this));\n IERC20(token).safeTransfer(user, amount);\n }\n\n function setToken(address _token) external {\n token = _token;\n }\n}\n" + }, + "contracts/mock/MockFraudVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/IVaultManager.sol\";\nimport \"../interfaces/ITreasury.sol\";\nimport \"../interfaces/IAgToken.sol\";\n\ncontract MockFraudVaultManager {\n using SafeERC20 for IERC20;\n\n ITreasury public treasury;\n mapping(uint256 => Vault) public vaultData;\n mapping(uint256 => address) public ownerOf;\n uint256 public surplus;\n uint256 public badDebt;\n IAgToken public stablecoin;\n address public oracle = address(this);\n\n address public governor;\n IERC20 public collateral;\n uint256 public oracleValue;\n uint256 public interestAccumulator;\n uint256 public collateralFactor;\n uint256 public totalNormalizedDebt;\n\n PaymentData public paymentData;\n\n constructor(address _treasury) {\n treasury = ITreasury(_treasury);\n }\n\n function accrueInterestToTreasury() external returns (uint256, uint256) {\n // Avoid the function to be view\n if (surplus >= badDebt) {\n stablecoin.mint(msg.sender, surplus - badDebt);\n }\n return (surplus, badDebt);\n }\n\n function read() external view returns (uint256) {\n return oracleValue;\n }\n\n function setParams(\n address _governor,\n address _collateral,\n address _stablecoin,\n uint256 _oracleValue,\n uint256 _interestAccumulator,\n uint256 _collateralFactor,\n uint256 _totalNormalizedDebt\n ) external {\n governor = _governor;\n collateral = IERC20(_collateral);\n stablecoin = IAgToken(_stablecoin);\n interestAccumulator = _interestAccumulator;\n collateralFactor = _collateralFactor;\n totalNormalizedDebt = _totalNormalizedDebt;\n oracleValue = _oracleValue;\n }\n\n function setOwner(uint256 vaultID, address owner) external {\n ownerOf[vaultID] = owner;\n }\n\n function setVaultData(\n uint256 normalizedDebt,\n uint256 collateralAmount,\n uint256 vaultID\n ) external {\n vaultData[vaultID].normalizedDebt = normalizedDebt;\n vaultData[vaultID].collateralAmount = collateralAmount;\n }\n\n function isGovernor(address admin) external view returns (bool) {\n return admin == governor;\n }\n\n function setSurplusBadDebt(\n uint256 _surplus,\n uint256 _badDebt,\n IAgToken _token\n ) external {\n surplus = _surplus;\n badDebt = _badDebt;\n stablecoin = _token;\n }\n\n function setPaymentData(\n uint256 stablecoinAmountToGive,\n uint256 stablecoinAmountToReceive,\n uint256 collateralAmountToGive,\n uint256 collateralAmountToReceive\n ) external {\n paymentData.stablecoinAmountToGive = stablecoinAmountToGive;\n paymentData.stablecoinAmountToReceive = stablecoinAmountToReceive;\n paymentData.collateralAmountToGive = collateralAmountToGive;\n paymentData.collateralAmountToReceive = collateralAmountToReceive;\n }\n\n function getDebtOut(\n uint256 vaultID,\n uint256 amountStablecoins,\n uint256 senderBorrowFee\n ) external {}\n\n function setTreasury(address _treasury) external {\n treasury = ITreasury(_treasury);\n }\n\n function getVaultDebt(uint256 vaultID) external view returns (uint256) {\n vaultID;\n stablecoin;\n return 0;\n }\n\n function createVault(address toVault) external view returns (uint256) {\n toVault;\n stablecoin;\n return 0;\n }\n\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) public payable returns (PaymentData memory) {\n datas;\n from;\n to;\n who;\n repayData;\n for (uint256 i; i < actions.length; ++i) {\n ActionBorrowType action = actions[i];\n action;\n }\n\n return paymentData;\n }\n}\n" + }, + "contracts/mock/MockLiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../interfaces/ILiquidityGauge.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\n/// @notice MockLiquidityGauge contract\ncontract MockLiquidityGauge is ILiquidityGauge {\n using SafeERC20 for IERC20;\n\n uint256 public factor = 10**18;\n\n IERC20 public token;\n mapping(address => uint256) public counter;\n mapping(address => uint256) public counter2;\n\n constructor(address _token) {\n token = IERC20(_token);\n }\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external override {\n IERC20(_rewardToken).transferFrom(msg.sender, address(this), _amount);\n }\n\n function setFactor(uint256 _factor) external {\n factor = _factor;\n }\n\n // solhint-disable-next-line\n function staking_token() external view override returns (address stakingToken) {\n return address(token);\n }\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external override {\n _value;\n _addr;\n _claim_rewards;\n counter2[_addr] += 1;\n return;\n }\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external override {\n _addr;\n counter[_addr] += 1;\n return;\n }\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external pure override {\n _addr;\n _receiver;\n return;\n }\n}\n" + }, + "contracts/mock/MockPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/ISanToken.sol\";\nimport \"../interfaces/IPerpetualManager.sol\";\n\ncontract MockPerpetualManager {\n using SafeERC20 for IERC20;\n\n IERC20 public rewardToken;\n IERC20 public token;\n uint256 public counter;\n mapping(uint256 => uint256) public perps;\n mapping(uint256 => uint256) public claims;\n\n function setRewardToken(address _rewardToken) external {\n rewardToken = IERC20(_rewardToken);\n }\n\n function setToken(address _token) external {\n token = IERC20(_token);\n }\n\n function getReward(uint256 perpetualID) external {\n claims[perpetualID] += 1;\n }\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external {\n token.safeTransferFrom(msg.sender, address(this), amount);\n perps[perpetualID] += amount;\n }\n\n function openPerpetual(\n address,\n uint256 amountBrought,\n uint256,\n uint256,\n uint256\n ) external returns (uint256 perpetualID) {\n token.safeTransferFrom(msg.sender, address(this), amountBrought);\n perpetualID = counter;\n counter += 1;\n perps[perpetualID] = amountBrought;\n }\n}\n" + }, + "contracts/mock/MockRouterSidechain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/external/IWETH9.sol\";\n\nimport \"../BaseRouter.sol\";\n\n/// @title MockRouterSidechain\n/// @author Angle Core Team\n/// @notice Mock contract but built for tests as if to be deployed on Ethereum\ncontract MockRouterSidechain is BaseRouter {\n IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function _wrapNative() internal pure override returns (uint256) {\n return 0;\n }\n\n function _unwrapNative(uint256, address) internal pure override returns (uint256 amount) {\n return 0;\n }\n\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return WETH;\n }\n}\n" + }, + "contracts/mock/MockSavingsRate.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol\";\n\ncontract MockSavingsRate is ERC4626 {\n constructor(IERC20Metadata asset_) ERC20(\"savingsRate\", \"sr\") ERC4626(asset_) {}\n}\n" + }, + "contracts/mock/MockStableMaster.sol": { + "content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol\";\n\nimport \"../interfaces/ISanToken.sol\";\nimport \"../interfaces/IPerpetualManager.sol\";\nimport \"../interfaces/IStableMasterFront.sol\";\n\nimport \"./MockAgToken.sol\";\n\ncontract MockStableMaster is IStableMasterFront {\n using SafeERC20 for IERC20;\n address public agToken;\n\n constructor(address _agToken) {\n agToken = _agToken;\n }\n\n struct Collateral {\n IERC20 collateral;\n ISanToken sanToken;\n IPerpetualManagerFrontWithClaim perpetualManager;\n address oracle;\n uint256 stocksUsers;\n uint256 sanRate;\n uint256 collatBase;\n SLPData slpData;\n MintBurnData feeData;\n }\n\n mapping(IPoolManager => Collateral) public collateralMap;\n\n function addCollateral(\n address poolManager,\n address collateral,\n address sanToken,\n address perpetualManager\n ) external {\n Collateral memory collat;\n collat.collateral = IERC20(collateral);\n collat.sanToken = ISanToken(sanToken);\n collat.perpetualManager = IPerpetualManagerFrontWithClaim(perpetualManager);\n collateralMap[IPoolManager(poolManager)] = collat;\n }\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256\n ) external {\n collateralMap[poolManager].collateral.safeTransferFrom(msg.sender, address(this), amount);\n MockAgToken(agToken).mint(user, amount);\n }\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256\n ) external {\n MockAgToken(agToken).burnSelf(amount, burner);\n collateralMap[poolManager].collateral.safeTransfer(dest, amount);\n }\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external {\n collateralMap[poolManager].collateral.safeTransferFrom(msg.sender, address(this), amount);\n IERC20(address(collateralMap[poolManager].sanToken)).safeTransfer(user, amount);\n }\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external {\n IERC20(address(collateralMap[poolManager].sanToken)).safeTransferFrom(burner, address(this), amount);\n collateralMap[poolManager].collateral.safeTransfer(dest, amount);\n }\n\n function updateStocksUsers(uint256, address) external {}\n}\n" + }, + "contracts/mock/MockSwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract MockSwapper {\n using SafeERC20 for IERC20;\n\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory\n ) external {\n inToken.safeTransferFrom(msg.sender, address(this), inTokenObtained);\n outToken.safeTransfer(outTokenRecipient, outTokenOwed);\n }\n}\n" + }, + "contracts/mock/MockToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/ERC20.sol\";\n\ncontract MockToken is ERC20 {\n event Minting(address indexed _to, address indexed _minter, uint256 _amount);\n\n event Burning(address indexed _from, address indexed _burner, uint256 _amount);\n\n uint8 internal _decimal;\n\n /// @notice stablecoin constructor\n /// @param name_ the stablecoin name (example 'agEUR')\n /// @param symbol_ the stablecoin symbol ('agEUR')\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimal_\n ) ERC20(name_, symbol_) {\n _decimal = decimal_;\n }\n\n /// @dev Returns the number of decimals used to get its user representation.\n /// For example, if `decimals` equals `2`, a balance of `505` tokens should\n /// be displayed to a user as `5,05` (`505 / 10 ** 2`).\n function decimals() public view override returns (uint8) {\n return _decimal;\n }\n\n /// @notice allow to mint\n /// @param account the account to mint to\n /// @param amount the amount to mint\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n emit Minting(account, msg.sender, amount);\n }\n\n /// @notice allow to burn\n /// @param account the account to burn from\n /// @param amount the amount of agToken to burn from caller\n function burn(address account, uint256 amount) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function setAllowance(address from, address to) public {\n _approve(from, to, type(uint256).max);\n }\n}\n" + }, + "contracts/mock/MockTokenPermit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol\";\n\ncontract MockTokenPermit is ERC20Permit {\n event Minting(address indexed _to, address indexed _minter, uint256 _amount);\n\n event Burning(address indexed _from, address indexed _burner, uint256 _amount);\n\n uint8 internal _decimal;\n\n /// @notice stablecoin constructor\n /// @param name_ the stablecoin name (example 'agEUR')\n /// @param symbol_ the stablecoin symbol ('agEUR')\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimal_\n ) ERC20Permit(name_) ERC20(name_, symbol_) {\n _decimal = decimal_;\n }\n\n /// @dev Returns the number of decimals used to get its user representation.\n /// For example, if `decimals` equals `2`, a balance of `505` tokens should\n /// be displayed to a user as `5,05` (`505 / 10 ** 2`).\n function decimals() public view override returns (uint8) {\n return _decimal;\n }\n\n /// @notice allow to mint\n /// @param account the account to mint to\n /// @param amount the amount to mint\n function mint(address account, uint256 amount) external {\n _mint(account, amount);\n emit Minting(account, msg.sender, amount);\n }\n\n /// @notice allow to burn\n /// @param account the account to burn from\n /// @param amount the amount of agToken to burn from caller\n function burn(address account, uint256 amount) public {\n _burn(account, amount);\n emit Burning(account, msg.sender, amount);\n }\n\n function setAllowance(address from, address to) public {\n _approve(from, to, type(uint256).max);\n }\n}\n" + }, + "contracts/mock/MockUniswapV3Router.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\";\n\nimport \"../interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./MockTokenPermit.sol\";\n\n// @notice mock contract to swap token\ncontract MockUniswapV3Router is IUniswapV3Router {\n uint256 public exchangeRate = 1 ether;\n IERC20Metadata public tokenA;\n IERC20Metadata public tokenB;\n uint256 public decimalsA;\n uint256 public decimalsB;\n\n constructor(IERC20Metadata _tokenA, IERC20Metadata _tokenB) {\n tokenA = _tokenA;\n tokenB = _tokenB;\n decimalsA = _tokenA.decimals();\n decimalsB = _tokenB.decimals();\n MockTokenPermit(address(tokenB)).mint(address(this), type(uint256).max / 1000);\n }\n\n function exactInput(ExactInputParams calldata params) external payable override returns (uint256 amountOut) {\n tokenA.transferFrom(msg.sender, address(this), params.amountIn);\n amountOut = (((params.amountIn * exchangeRate) / 1 ether) * 10**decimalsB) / 10**decimalsA;\n tokenB.transfer(msg.sender, amountOut);\n }\n\n function updateExchangeRate(uint256 newExchangeRate) external {\n exchangeRate = newExchangeRate;\n }\n}\n" + }, + "contracts/mock/MockVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/IVaultManager.sol\";\nimport \"../interfaces/ITreasury.sol\";\nimport \"../interfaces/IAgToken.sol\";\n\ncontract MockVaultManager {\n using SafeERC20 for IERC20;\n\n ITreasury public treasury;\n mapping(uint256 => Vault) public vaultData;\n mapping(uint256 => address) public ownerOf;\n uint256 public surplus;\n uint256 public badDebt;\n IAgToken public stablecoin;\n address public oracle = address(this);\n\n address public governor;\n IERC20 public collateral;\n uint256 public oracleValue;\n uint256 public interestAccumulator;\n uint256 public collateralFactor;\n uint256 public totalNormalizedDebt;\n\n PaymentData public paymentData;\n\n constructor(address _treasury) {\n treasury = ITreasury(_treasury);\n }\n\n function accrueInterestToTreasury() external returns (uint256, uint256) {\n // Avoid the function to be view\n if (surplus >= badDebt) {\n stablecoin.mint(msg.sender, surplus - badDebt);\n }\n return (surplus, badDebt);\n }\n\n function read() external view returns (uint256) {\n return oracleValue;\n }\n\n function setParams(\n address _governor,\n address _collateral,\n address _stablecoin,\n uint256 _oracleValue,\n uint256 _interestAccumulator,\n uint256 _collateralFactor,\n uint256 _totalNormalizedDebt\n ) external {\n governor = _governor;\n collateral = IERC20(_collateral);\n stablecoin = IAgToken(_stablecoin);\n interestAccumulator = _interestAccumulator;\n collateralFactor = _collateralFactor;\n totalNormalizedDebt = _totalNormalizedDebt;\n oracleValue = _oracleValue;\n }\n\n function setOwner(uint256 vaultID, address owner) external {\n ownerOf[vaultID] = owner;\n }\n\n function setVaultData(\n uint256 normalizedDebt,\n uint256 collateralAmount,\n uint256 vaultID\n ) external {\n vaultData[vaultID].normalizedDebt = normalizedDebt;\n vaultData[vaultID].collateralAmount = collateralAmount;\n }\n\n function isGovernor(address admin) external view returns (bool) {\n return admin == governor;\n }\n\n function setSurplusBadDebt(\n uint256 _surplus,\n uint256 _badDebt,\n IAgToken _token\n ) external {\n surplus = _surplus;\n badDebt = _badDebt;\n stablecoin = _token;\n }\n\n function setPaymentData(\n uint256 stablecoinAmountToGive,\n uint256 stablecoinAmountToReceive,\n uint256 collateralAmountToGive,\n uint256 collateralAmountToReceive\n ) external {\n paymentData.stablecoinAmountToGive = stablecoinAmountToGive;\n paymentData.stablecoinAmountToReceive = stablecoinAmountToReceive;\n paymentData.collateralAmountToGive = collateralAmountToGive;\n paymentData.collateralAmountToReceive = collateralAmountToReceive;\n }\n\n function getDebtOut(\n uint256 vaultID,\n uint256 amountStablecoins,\n uint256 senderBorrowFee\n ) external {}\n\n function setTreasury(address _treasury) external {\n treasury = ITreasury(_treasury);\n }\n\n function getVaultDebt(uint256 vaultID) external view returns (uint256) {\n vaultID;\n stablecoin;\n return 0;\n }\n\n function createVault(address toVault) external view returns (uint256) {\n toVault;\n stablecoin;\n return 0;\n }\n\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) public payable returns (PaymentData memory) {\n datas;\n from;\n to;\n who;\n repayData;\n for (uint256 i; i < actions.length; ++i) {\n ActionBorrowType action = actions[i];\n action;\n }\n\n if (paymentData.stablecoinAmountToReceive >= paymentData.stablecoinAmountToGive) {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToReceive - paymentData.stablecoinAmountToGive;\n if (paymentData.collateralAmountToGive >= paymentData.collateralAmountToReceive) {\n uint256 collateralAmountToGive = paymentData.collateralAmountToGive -\n paymentData.collateralAmountToReceive;\n collateral.safeTransfer(to, collateralAmountToGive);\n stablecoin.burnFrom(stablecoinPayment, from, msg.sender);\n } else {\n if (stablecoinPayment > 0) stablecoin.burnFrom(stablecoinPayment, from, msg.sender);\n // In this case the collateral amount is necessarily non null\n collateral.safeTransferFrom(\n msg.sender,\n address(this),\n paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive\n );\n }\n } else {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToGive - paymentData.stablecoinAmountToReceive;\n // `stablecoinPayment` is strictly positive in this case\n stablecoin.mint(to, stablecoinPayment);\n if (paymentData.collateralAmountToGive > paymentData.collateralAmountToReceive) {\n collateral.safeTransfer(to, paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive);\n } else {\n uint256 collateralPayment = paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive;\n collateral.safeTransferFrom(msg.sender, address(this), collateralPayment);\n }\n }\n\n return paymentData;\n }\n}\n" + }, + "contracts/mock/MockVaultManagerPermit.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\";\n\nimport \"../interfaces/IVaultManager.sol\";\nimport \"../interfaces/ITreasury.sol\";\nimport \"../interfaces/IAgToken.sol\";\nimport \"../interfaces/external/IERC1271.sol\";\n\ncontract MockVaultManagerPermit {\n using Address for address;\n using SafeERC20 for IERC20;\n\n ITreasury public treasury;\n mapping(uint256 => Vault) public vaultData;\n mapping(uint256 => address) public ownerOf;\n uint256 public surplus;\n uint256 public badDebt;\n uint256 public vaultIDCount;\n IAgToken public stablecoin;\n address public oracle = address(this);\n\n address public governor;\n IERC20 public collateral;\n uint256 public oracleValue;\n uint256 public interestAccumulator;\n uint256 public collateralFactor;\n uint256 public totalNormalizedDebt;\n\n /* solhint-disable var-name-mixedcase */\n bytes32 private _HASHED_NAME;\n bytes32 private _HASHED_VERSION;\n bytes32 private _PERMIT_TYPEHASH;\n /* solhint-enable var-name-mixedcase */\n\n PaymentData public paymentData;\n\n mapping(address => uint256) private _nonces;\n // Mapping from owner to operator approvals\n mapping(address => mapping(address => uint256)) public operatorApprovals;\n mapping(uint256 => mapping(address => bool)) public approved;\n error ExpiredDeadline();\n error InvalidSignature();\n\n constructor(string memory _name) {\n _PERMIT_TYPEHASH = keccak256(\n \"Permit(address owner,address spender,bool approved,uint256 nonce,uint256 deadline)\"\n );\n _HASHED_NAME = keccak256(bytes(_name));\n _HASHED_VERSION = keccak256(bytes(\"1\"));\n }\n\n function accrueInterestToTreasury() external returns (uint256, uint256) {\n // Avoid the function to be view\n if (surplus >= badDebt) {\n stablecoin.mint(msg.sender, surplus - badDebt);\n }\n return (surplus, badDebt);\n }\n\n function read() external view returns (uint256) {\n return oracleValue;\n }\n\n function setParams(\n address _governor,\n address _collateral,\n address _stablecoin,\n uint256 _oracleValue,\n uint256 _interestAccumulator,\n uint256 _collateralFactor,\n uint256 _totalNormalizedDebt\n ) external {\n governor = _governor;\n collateral = IERC20(_collateral);\n stablecoin = IAgToken(_stablecoin);\n interestAccumulator = _interestAccumulator;\n collateralFactor = _collateralFactor;\n totalNormalizedDebt = _totalNormalizedDebt;\n oracleValue = _oracleValue;\n }\n\n function setOwner(uint256 vaultID, address owner) external {\n ownerOf[vaultID] = owner;\n }\n\n function setVaultData(\n uint256 normalizedDebt,\n uint256 collateralAmount,\n uint256 vaultID\n ) external {\n vaultData[vaultID].normalizedDebt = normalizedDebt;\n vaultData[vaultID].collateralAmount = collateralAmount;\n }\n\n function isGovernor(address admin) external view returns (bool) {\n return admin == governor;\n }\n\n function updateVaultIDCount(uint256 _vaultIDCount) external {\n vaultIDCount = _vaultIDCount;\n }\n\n function setSurplusBadDebt(\n uint256 _surplus,\n uint256 _badDebt,\n IAgToken _token\n ) external {\n surplus = _surplus;\n badDebt = _badDebt;\n stablecoin = _token;\n }\n\n function setPaymentData(\n uint256 stablecoinAmountToGive,\n uint256 stablecoinAmountToReceive,\n uint256 collateralAmountToGive,\n uint256 collateralAmountToReceive\n ) external {\n paymentData.stablecoinAmountToGive = stablecoinAmountToGive;\n paymentData.stablecoinAmountToReceive = stablecoinAmountToReceive;\n paymentData.collateralAmountToGive = collateralAmountToGive;\n paymentData.collateralAmountToReceive = collateralAmountToReceive;\n }\n\n function getDebtOut(\n uint256 vaultID,\n uint256 amountStablecoins,\n uint256 senderBorrowFee\n ) external {}\n\n function setTreasury(address _treasury) external {\n treasury = ITreasury(_treasury);\n }\n\n function getVaultDebt(uint256 vaultID) external view returns (uint256) {\n vaultID;\n stablecoin;\n return 0;\n }\n\n function createVault(address toVault) external view returns (uint256) {\n toVault;\n stablecoin;\n return 0;\n }\n\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) public payable virtual returns (PaymentData memory) {\n datas;\n from;\n to;\n who;\n repayData;\n for (uint256 i; i < actions.length; ++i) {\n ActionBorrowType action = actions[i];\n action;\n }\n\n if (paymentData.stablecoinAmountToReceive >= paymentData.stablecoinAmountToGive) {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToReceive - paymentData.stablecoinAmountToGive;\n if (paymentData.collateralAmountToGive >= paymentData.collateralAmountToReceive) {\n uint256 collateralAmountToGive = paymentData.collateralAmountToGive -\n paymentData.collateralAmountToReceive;\n collateral.safeTransfer(to, collateralAmountToGive);\n stablecoin.burnFrom(stablecoinPayment, from, msg.sender);\n } else {\n if (stablecoinPayment > 0) stablecoin.burnFrom(stablecoinPayment, from, msg.sender);\n // In this case the collateral amount is necessarily non null\n collateral.safeTransferFrom(\n msg.sender,\n address(this),\n paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive\n );\n }\n } else {\n uint256 stablecoinPayment = paymentData.stablecoinAmountToGive - paymentData.stablecoinAmountToReceive;\n // `stablecoinPayment` is strictly positive in this case\n stablecoin.mint(to, stablecoinPayment);\n if (paymentData.collateralAmountToGive > paymentData.collateralAmountToReceive) {\n collateral.safeTransfer(to, paymentData.collateralAmountToGive - paymentData.collateralAmountToReceive);\n } else {\n uint256 collateralPayment = paymentData.collateralAmountToReceive - paymentData.collateralAmountToGive;\n collateral.safeTransferFrom(msg.sender, address(this), collateralPayment);\n }\n }\n\n return paymentData;\n }\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approvedStatus Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approvedStatus,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external {\n if (block.timestamp > deadline) revert ExpiredDeadline();\n // Additional signature checks performed in the `ECDSAUpgradeable.recover` function\n if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0 || (v != 27 && v != 28))\n revert InvalidSignature();\n\n bytes32 digest = keccak256(\n abi.encodePacked(\n \"\\x19\\x01\",\n _domainSeparatorV4(),\n keccak256(\n abi.encode(\n _PERMIT_TYPEHASH,\n // 0x3f43a9c6bafb5c7aab4e0cfe239dc5d4c15caf0381c6104188191f78a6640bd8,\n owner,\n spender,\n approvedStatus,\n _useNonce(owner),\n deadline\n )\n )\n )\n );\n if (owner.isContract()) {\n if (IERC1271(owner).isValidSignature(digest, abi.encodePacked(r, s, v)) != 0x1626ba7e)\n revert InvalidSignature();\n } else {\n address signer = ecrecover(digest, v, r, s);\n if (signer != owner || signer == address(0)) revert InvalidSignature();\n }\n\n _setApprovalForAll(owner, spender, approvedStatus);\n }\n\n function approveSpenderVault(\n address spender,\n uint256 vaultID,\n bool status\n ) external {\n approved[vaultID][spender] = status;\n }\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool) {\n return approved[vaultID][spender];\n }\n\n /// @notice Internal version of the `setApprovalForAll` function\n /// @dev It contains an `approver` field to be used in case someone signs a permit for a particular\n /// address, and this signature is given to the contract by another address (like a router)\n function _setApprovalForAll(\n address approver,\n address operator,\n bool approvedStatus\n ) internal {\n if (operator == approver) revert(\"approval to caller\");\n uint256 approval = approvedStatus ? 1 : 0;\n operatorApprovals[approver][operator] = approval;\n }\n\n /// @notice Returns the current nonce for an `owner` address\n function nonces(address owner) public view returns (uint256) {\n return _nonces[owner];\n }\n\n /// @notice Returns the domain separator for the current chain.\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32) {\n return _domainSeparatorV4();\n }\n\n /// @notice Internal version of the `DOMAIN_SEPARATOR` function\n function _domainSeparatorV4() internal view returns (bytes32) {\n return\n keccak256(\n abi.encode(\n // keccak256('EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)')\n 0x8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f,\n _HASHED_NAME,\n _HASHED_VERSION,\n block.chainid,\n address(this)\n )\n );\n }\n\n /// @notice Consumes a nonce for an address: returns the current value and increments it\n function _useNonce(address owner) internal returns (uint256 current) {\n current = _nonces[owner];\n _nonces[owner] = current + 1;\n }\n\n uint256[49] private __gap;\n}\n" + }, + "contracts/mock/MockVaultManagerPermitCollateral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./MockVaultManagerPermit.sol\";\n\ncontract MockVaultManagerPermitCollateral is MockVaultManagerPermit {\n using Address for address;\n using SafeERC20 for IERC20;\n\n mapping(uint256 => uint256) public collatData;\n\n constructor(string memory _name) MockVaultManagerPermit(_name) {}\n\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address,\n address,\n address,\n bytes memory\n ) public payable override returns (PaymentData memory) {\n for (uint256 i; i < actions.length; ++i) {\n ActionBorrowType action = actions[i];\n action;\n if (action == ActionBorrowType.addCollateral) {\n (uint256 vaultID, uint256 collateralAmount) = abi.decode(datas[i], (uint256, uint256));\n collatData[vaultID] += collateralAmount;\n collateral.safeTransferFrom(msg.sender, address(this), collateralAmount);\n }\n }\n PaymentData memory returnValue;\n return returnValue;\n }\n\n uint256[49] private __gap;\n}\n" + }, + "contracts/mock/MockVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\ncontract MockVeANGLE {\n using SafeERC20 for IERC20;\n IERC20 public angle;\n mapping(address => uint256) public counter;\n\n //solhint-disable-next-line\n function deposit_for(address user, uint256 amount) external {\n angle.safeTransferFrom(msg.sender, address(this), amount);\n counter[user] = amount;\n }\n\n function setAngle(address _angle) external {\n angle = IERC20(_angle);\n }\n}\n" + }, + "contracts/mock/MockWETH.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./MockToken.sol\";\n\ncontract MockWETH is MockToken {\n event Deposit(address indexed dst, uint256 wad);\n event Withdrawal(address indexed src, uint256 wad);\n\n receive() external payable {}\n\n /// @notice stablecoin constructor\n /// @param name_ the stablecoin name (example 'agEUR')\n /// @param symbol_ the stablecoin symbol ('agEUR')\n constructor(\n string memory name_,\n string memory symbol_,\n uint8 decimal_\n ) MockToken(name_, symbol_, decimal_) {}\n\n function deposit() public payable {\n _mint(msg.sender, msg.value);\n emit Deposit(msg.sender, msg.value);\n }\n\n function withdraw(uint256 wad) public {\n _burn(msg.sender, wad);\n (bool sent, ) = msg.sender.call{ value: wad }(\"\");\n require(sent, \"Failed to send Ether\");\n emit Withdrawal(msg.sender, wad);\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/AngleRouterMainnetV3_0_Implementation.json b/deployments/mainnet/AngleRouterMainnetV3_0_Implementation.json new file mode 100644 index 0000000..8c613bd --- /dev/null +++ b/deployments/mainnet/AngleRouterMainnetV3_0_Implementation.json @@ -0,0 +1,808 @@ +{ + "address": "0xe5a3cE0Ba4E656f68BB6fC32509565e7564d3B76", + "abi": [ + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidParams", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReturnMessage", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferredDeposit", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "spenders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "changeAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit4626Referral", + "outputs": [ + { + "internalType": "uint256", + "name": "sharesOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_uniswapRouter", + "type": "address" + }, + { + "internalType": "address", + "name": "_oneInch", + "type": "address" + } + ], + "name": "initializeRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IStableMasterFront", + "name": "", + "type": "address" + }, + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "name": "mapPoolManagers", + "outputs": [ + { + "internalType": "contract IPoolManager", + "name": "poolManager", + "type": "address" + }, + { + "internalType": "contract IPerpetualManagerFrontWithClaim", + "name": "perpetualManager", + "type": "address" + }, + { + "internalType": "contract ISanToken", + "name": "sanToken", + "type": "address" + }, + { + "internalType": "contract ILiquidityGauge", + "name": "gauge", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "name": "mapStableMasters", + "outputs": [ + { + "internalType": "contract IStableMasterFront", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vaultManager", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitVaultManagerType[]", + "name": "paramsPermitVaultManager", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixerVaultManagerPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "oneInch", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "_core", + "type": "address" + } + ], + "name": "setCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "internalType": "uint8", + "name": "who", + "type": "uint8" + } + ], + "name": "setRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "uniswapV3Router", + "outputs": [ + { + "internalType": "contract IUniswapV3Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0x6cd5f7735eb461ae635b2707ab258a3d250788cdce2d52b04d7e1458edbfd4ba", + "receipt": { + "to": null, + "from": "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701", + "contractAddress": "0xe5a3cE0Ba4E656f68BB6fC32509565e7564d3B76", + "transactionIndex": 85, + "gasUsed": "3783647", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "blockHash": "0x0e8e8c934af8ab2827515eec181d1218b3e5626261d3a56c8ec2060f70ea7ef7", + "transactionHash": "0x6cd5f7735eb461ae635b2707ab258a3d250788cdce2d52b04d7e1458edbfd4ba", + "logs": [ + { + "transactionIndex": 85, + "blockNumber": 19859967, + "transactionHash": "0x6cd5f7735eb461ae635b2707ab258a3d250788cdce2d52b04d7e1458edbfd4ba", + "address": "0xe5a3cE0Ba4E656f68BB6fC32509565e7564d3B76", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 310, + "blockHash": "0x0e8e8c934af8ab2827515eec181d1218b3e5626261d3a56c8ec2060f70ea7ef7" + } + ], + "blockNumber": 19859967, + "cumulativeGasUsed": "12032832", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0d1b1c94fd2e1964436c8b9a0e25c545", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidParams\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReturnMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApprovedOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferredDeposit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"spenders\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"changeAllowance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minSharesOut\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"deposit4626Referral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sharesOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_uniswapRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oneInch\",\"type\":\"address\"}],\"name\":\"initializeRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IStableMasterFront\",\"name\":\"\",\"type\":\"address\"},{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mapPoolManagers\",\"outputs\":[{\"internalType\":\"contract IPoolManager\",\"name\":\"poolManager\",\"type\":\"address\"},{\"internalType\":\"contract IPerpetualManagerFrontWithClaim\",\"name\":\"perpetualManager\",\"type\":\"address\"},{\"internalType\":\"contract ISanToken\",\"name\":\"sanToken\",\"type\":\"address\"},{\"internalType\":\"contract ILiquidityGauge\",\"name\":\"gauge\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract IERC20\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"mapStableMasters\",\"outputs\":[{\"internalType\":\"contract IStableMasterFront\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"vaultManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitVaultManagerType[]\",\"name\":\"paramsPermitVaultManager\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixerVaultManagerPermit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oneInch\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"setCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"who\",\"type\":\"uint8\"}],\"name\":\"setRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV3Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Router\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"details\":\"Previous implementation with an initialization function can be found here: https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\",\"kind\":\"dev\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"params\":{\"amounts\":\"Amounts to allow\",\"spenders\":\"Addresses to allow transfer\",\"tokens\":\"Addresses of the tokens to allow\"}},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens\",\"params\":{\"actions\":\"List of actions to be performed by the router (in order of execution)\",\"data\":\"Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored\",\"paramsPermit\":\"Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\"}},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option\",\"params\":{\"paramsPermitVaultManager\":\"Parameters to sign permit to give allowance to the router for a `VaultManager` contract\"}}},\"title\":\"AngleRouterMainnet\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"notice\":\"Changes allowances for different tokens\"},\"core()\":{\"notice\":\"Core address handling access control\"},\"deposit4626Referral(address,address,uint256,address,uint256,address)\":{\"notice\":\"Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract\"},\"initializeRouter(address,address,address)\":{\"notice\":\"Deploys the router contract on a chain\"},\"mapPoolManagers(address,address)\":{\"notice\":\"Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\"},\"mapStableMasters(address)\":{\"notice\":\"Maps an agToken to its counterpart `StableMaster`\"},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Allows composable calls to different functions within the protocol\"},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions\"},\"oneInch()\":{\"notice\":\"Address of 1Inch router used for swaps\"},\"setCore(address)\":{\"notice\":\"Sets a new `core` contract\"},\"setRouter(address,uint8)\":{\"notice\":\"Sets a new router variable\"},\"uniswapV3Router()\":{\"notice\":\"Address of the router used for swaps\"}},\"notice\":\"Router contract built specifially for Angle use cases on Ethereum\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/implementations/mainnet/AngleRouterMainnet.sol\":\"AngleRouterMainnet\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20Upgradeable {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x4e733d3164f73f461eaf9d8087a7ad1ea180bdc8ba0d3d61b0e1ae16d8e63dff\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x9750c6fec736eb3320e85924f36a3060fa4a4ab1758d06d9585e175d164eefdb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\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 IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\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 require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\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 */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\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. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"contracts/BaseRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport \\\"./interfaces/external/uniswap/IUniswapRouter.sol\\\";\\nimport \\\"./interfaces/external/IWETH9.sol\\\";\\nimport \\\"./interfaces/ICoreBorrow.sol\\\";\\nimport \\\"./interfaces/IDepositWithReferral.sol\\\";\\nimport \\\"./interfaces/ILiquidityGauge.sol\\\";\\nimport \\\"./interfaces/ISwapper.sol\\\";\\nimport \\\"./interfaces/IVaultManager.sol\\\";\\n\\n// ============================== STRUCTS AND ENUM =============================\\n\\n/// @notice Action types\\nenum ActionType {\\n transfer,\\n wrapNative,\\n unwrapNative,\\n sweep,\\n sweepNative,\\n // Deprecated\\n uniswapV3,\\n oneInch,\\n claimRewards,\\n // Deprecated\\n gaugeDeposit,\\n borrower,\\n swapper,\\n mint4626,\\n deposit4626,\\n redeem4626,\\n withdraw4626,\\n // Deprecated\\n prepareRedeemSavingsRate,\\n // Deprecated\\n claimRedeemSavingsRate,\\n // Deprecated\\n swapIn,\\n // Deprecated\\n swapOut,\\n claimWeeklyInterest,\\n // Deprecated\\n withdraw,\\n // Deprecated\\n mint,\\n // Deprecated\\n deposit,\\n // Deprecated\\n openPerpetual,\\n // Deprecated\\n addToPerpetual,\\n veANGLEDeposit,\\n // Deprecated\\n claimRewardsWithPerps,\\n deposit4626Referral\\n}\\n\\n/// @notice Data needed to get permits\\nstruct PermitType {\\n address token;\\n address owner;\\n uint256 value;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @notice Data to grant permit to the router for a vault\\nstruct PermitVaultManagerType {\\n address vaultManager;\\n address owner;\\n bool approved;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @title BaseRouter\\n/// @author Angle Core Team\\n/// @notice Base contract that Angle router contracts on different chains should override\\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\\n using SafeERC20 for IERC20;\\n\\n // ================================= REFERENCES ================================\\n\\n /// @notice Core address handling access control\\n ICoreBorrow public core;\\n /// @notice Address of the router used for swaps\\n IUniswapV3Router public uniswapV3Router;\\n /// @notice Address of 1Inch router used for swaps\\n address public oneInch;\\n\\n uint256[47] private __gap;\\n\\n // ============================== EVENTS / ERRORS ==============================\\n\\n error IncompatibleLengths();\\n error InvalidReturnMessage();\\n error NotApprovedOrOwner();\\n error NotGovernor();\\n error NotGovernorOrGuardian();\\n error TooSmallAmountOut();\\n error TransferFailed();\\n error ZeroAddress();\\n\\n event ReferredDeposit(\\n address caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares,\\n address indexed savings,\\n address indexed referrer\\n );\\n\\n /// @notice Deploys the router contract on a chain\\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\\n if (_core == address(0)) revert ZeroAddress();\\n core = ICoreBorrow(_core);\\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\\n oneInch = _oneInch;\\n }\\n\\n constructor() initializer {}\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @notice Allows composable calls to different functions within the protocol\\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\\n /// @param actions List of actions to be performed by the router (in order of execution)\\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\\n /// for a given action are stored\\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\\n /// do not perform a sweep action on these tokens\\n function mixer(\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) public payable virtual {\\n // If all tokens have already been approved, there's no need for this step\\n uint256 permitsLength = paramsPermit.length;\\n for (uint256 i; i < permitsLength; ++i) {\\n IERC20Permit(paramsPermit[i].token).permit(\\n paramsPermit[i].owner,\\n address(this),\\n paramsPermit[i].value,\\n paramsPermit[i].deadline,\\n paramsPermit[i].v,\\n paramsPermit[i].r,\\n paramsPermit[i].s\\n );\\n }\\n // Performing actions one after the others\\n uint256 actionsLength = actions.length;\\n for (uint256 i; i < actionsLength; ++i) {\\n if (actions[i] == ActionType.transfer) {\\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\\n } else if (actions[i] == ActionType.wrapNative) {\\n _wrapNative();\\n } else if (actions[i] == ActionType.unwrapNative) {\\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\\n _unwrapNative(minAmountOut, to);\\n } else if (actions[i] == ActionType.sweep) {\\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\\n _sweep(tokenOut, minAmountOut, to);\\n } else if (actions[i] == ActionType.sweepNative) {\\n uint256 routerBalance = address(this).balance;\\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\\n } else if (actions[i] == ActionType.oneInch) {\\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\\n data[i],\\n (address, uint256, bytes)\\n );\\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\\n } else if (actions[i] == ActionType.claimRewards) {\\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\\n _claimRewards(user, claimLiquidityGauges);\\n } else if (actions[i] == ActionType.borrower) {\\n (\\n address collateral,\\n address vaultManager,\\n address to,\\n address who,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n bytes memory repayData\\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\\n } else if (actions[i] == ActionType.swapper) {\\n (\\n ISwapper swapperContract,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory payload\\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\\n } else if (actions[i] == ActionType.mint4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _mint4626(savingsRate, shares, to, maxAmountIn);\\n } else if (actions[i] == ActionType.deposit4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626(savingsRate, amount, to, minSharesOut);\\n } else if (actions[i] == ActionType.deposit4626Referral) {\\n (\\n IERC20 token,\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\\n } else if (actions[i] == ActionType.redeem4626) {\\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _redeem4626(savingsRate, shares, to, minAmountOut);\\n } else if (actions[i] == ActionType.withdraw4626) {\\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\\n } else {\\n _chainSpecificAction(actions[i], data[i]);\\n }\\n }\\n }\\n\\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\\n /// addresses depositing from a certain referring address into an ERC4626 contract\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut) {\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n _changeAllowance(IERC20(token), savings, type(uint256).max);\\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\\n }\\n\\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\\n /// actions and then revoking this approval after these actions\\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\\n /// to revoke approvals\\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\\n /// is just an option\\n function mixerVaultManagerPermit(\\n PermitVaultManagerType[] memory paramsPermitVaultManager,\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) external payable virtual {\\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n true,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n } else break;\\n }\\n mixer(paramsPermit, actions, data);\\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\\n // too deep\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (!paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n false,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n }\\n }\\n }\\n\\n receive() external payable {}\\n\\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\\n\\n /// @notice Wraps the native token of a chain to its wrapped version\\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\\n /// @dev The amount to wrap is to be specified in the `msg.value`\\n function _wrapNative() internal virtual returns (uint256) {\\n _getNativeWrapper().deposit{ value: msg.value }();\\n return msg.value;\\n }\\n\\n /// @notice Unwraps the wrapped version of a token to the native chain token\\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\\n amount = _getNativeWrapper().balanceOf(address(this));\\n _slippageCheck(amount, minAmountOut);\\n if (amount != 0) {\\n _getNativeWrapper().withdraw(amount);\\n _safeTransferNative(to, amount);\\n }\\n return amount;\\n }\\n\\n /// @notice Internal version of the `claimRewards` function\\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\\n uint256 gaugesLength = liquidityGauges.length;\\n for (uint256 i; i < gaugesLength; ++i) {\\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\\n }\\n }\\n\\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\\n /// @param vaultManager Address of the vault to perform actions on\\n /// @param actionsBorrow Actions type to perform on the vaultManager\\n /// @param dataBorrow Data needed for each actions\\n /// @param to Address to send the funds to\\n /// @param who Swapper address to handle repayments\\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\\n function _angleBorrower(\\n address vaultManager,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address to,\\n address who,\\n bytes memory repayData\\n ) internal virtual returns (PaymentData memory paymentData) {\\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\\n }\\n\\n /// @notice Sweeps tokens from the router contract\\n /// @param tokenOut Token to sweep\\n /// @param minAmountOut Minimum amount of tokens to recover\\n /// @param to Address to which tokens should be sent\\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\\n _slippageCheck(balanceToken, minAmountOut);\\n if (balanceToken != 0) {\\n IERC20(tokenOut).safeTransfer(to, balanceToken);\\n }\\n }\\n\\n /// @notice Uses an external swapper\\n /// @param swapper Contracts implementing the logic of the swap\\n /// @param inToken Token used to do the swap\\n /// @param outToken Token wanted\\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\\n /// @param inTokenObtained Amount of `inToken` used for the swap\\n /// @param data Additional info for the specific swapper\\n function _swapper(\\n ISwapper swapper,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) internal {\\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\\n }\\n\\n /// @notice Swaps an inToken to another token via 1Inch Router\\n /// @param payload Bytes needed for 1Inch router to process the swap\\n /// @dev The `payload` given is expected to be obtained from 1Inch API\\n function _swapOn1Inch(\\n IERC20 inToken,\\n uint256 minAmountOut,\\n bytes memory payload\\n ) internal returns (uint256 amountOut) {\\n // Approve transfer to the `oneInch` address\\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\\n address oneInchRouter = oneInch;\\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\\n //solhint-disable-next-line\\n (bool success, bytes memory result) = oneInchRouter.call(payload);\\n if (!success) _revertBytes(result);\\n\\n amountOut = abi.decode(result, (uint256));\\n _slippageCheck(amountOut, minAmountOut);\\n }\\n\\n /// @notice Mints `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to mint shares from\\n /// @param shares Amount of shares to mint from the contract\\n /// @param to Address to which shares should be sent\\n /// @param maxAmountIn Max amount of assets used to mint\\n /// @return amountIn Amount of assets used to mint by `to`\\n function _mint4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 maxAmountIn\\n ) internal returns (uint256 amountIn) {\\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\\n }\\n\\n /// @notice Deposits `amount` to an ERC4626 contract\\n /// @param savingsRate The ERC4626 to deposit assets to\\n /// @param amount Amount of assets to deposit\\n /// @param to Address to which shares should be sent\\n /// @param minSharesOut Minimum amount of shares that `to` should received\\n /// @return sharesOut Amount of shares received by `to`\\n function _deposit4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\\n }\\n\\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\\n function _deposit4626Referral(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) internal returns (uint256 sharesOut) {\\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\\n }\\n\\n /// @notice Withdraws `amount` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to withdraw assets from\\n /// @param amount Amount of assets to withdraw\\n /// @param to Destination of assets\\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\\n /// @return sharesOut Amount of shares burnt\\n function _withdraw4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 maxSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\\n }\\n\\n /// @notice Redeems `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to redeem shares from\\n /// @param shares Amount of shares to redeem\\n /// @param to Destination of assets\\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\\n /// @return amountOut Amount of assets received by `to`\\n function _redeem4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 minAmountOut\\n ) internal returns (uint256 amountOut) {\\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\\n }\\n\\n /// @notice Allows to perform some specific actions for a chain\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\\n\\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\\n\\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\\n\\n // ============================ GOVERNANCE FUNCTION ============================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Sets a new `core` contract\\n function setCore(ICoreBorrow _core) external {\\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\\n core = ICoreBorrow(_core);\\n }\\n\\n /// @notice Changes allowances for different tokens\\n /// @param tokens Addresses of the tokens to allow\\n /// @param spenders Addresses to allow transfer\\n /// @param amounts Amounts to allow\\n function changeAllowance(\\n IERC20[] calldata tokens,\\n address[] calldata spenders,\\n uint256[] calldata amounts\\n ) external onlyGovernorOrGuardian {\\n uint256 tokensLength = tokens.length;\\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\\n for (uint256 i; i < tokensLength; ++i) {\\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\\n }\\n }\\n\\n /// @notice Sets a new router variable\\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\\n if (router == address(0)) revert ZeroAddress();\\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\\n else oneInch = router;\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Changes allowance of this contract for a given token\\n /// @param token Address of the token to change allowance\\n /// @param spender Address to change the allowance of\\n /// @param amount Amount allowed\\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\\n } else if (currentAllowance > amount) {\\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\\n }\\n }\\n\\n /// @notice Transfer amount of the native token to the `to` address\\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\\n function _safeTransferNative(address to, uint256 amount) internal {\\n bool success;\\n //solhint-disable-next-line\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n if (!success) revert TransferFailed();\\n }\\n\\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\\n /// the calling address is well approved for all the vaults with which it is interacting\\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\\n /// with a vault are approved for this vault\\n function _parseVaultIDs(\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address vaultManager,\\n address collateral\\n ) internal view returns (bytes[] memory) {\\n uint256 actionsBorrowLength = actionsBorrow.length;\\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\\n bool createVaultAction;\\n uint256 lastVaultID;\\n uint256 vaultIDLength;\\n for (uint256 i; i < actionsBorrowLength; ++i) {\\n uint256 vaultID;\\n // If there is a `createVault` action, the router should not worry about looking at\\n // next vaultIDs given equal to 0\\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\\n createVaultAction = true;\\n continue;\\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\\n // as collateral the full contract balance\\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\\n uint256 amount;\\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\\n if (amount == type(uint256).max)\\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\\n continue;\\n // There are different ways depending on the action to find the `vaultID` to parse\\n } else if (\\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\\n ) {\\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\\n vaultID = abi.decode(dataBorrow[i], (uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\\n } else continue;\\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\\n // if there has not been any specific action\\n if (vaultID == 0) {\\n if (createVaultAction) {\\n continue;\\n } else {\\n // If we haven't stored the last `vaultID`, we need to fetch it\\n if (lastVaultID == 0) {\\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\\n }\\n vaultID = lastVaultID;\\n }\\n }\\n\\n // Check if this `vaultID` has already been verified\\n for (uint256 j; j < vaultIDLength; ++j) {\\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\\n // If yes, we continue to the next iteration\\n continue;\\n }\\n }\\n // Verify this new `vaultID` and add it to the list\\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\\n revert NotApprovedOrOwner();\\n }\\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\\n vaultIDLength += 1;\\n }\\n return dataBorrow;\\n }\\n\\n /// @notice Checks whether the amount obtained during a swap is not too small\\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\\n if (amount < thresholdAmount) revert TooSmallAmountOut();\\n }\\n\\n /// @notice Internal function used for error handling\\n function _revertBytes(bytes memory errMsg) internal pure {\\n if (errMsg.length != 0) {\\n //solhint-disable-next-line\\n assembly {\\n revert(add(32, errMsg), mload(errMsg))\\n }\\n }\\n revert InvalidReturnMessage();\\n }\\n}\\n\",\"keccak256\":\"0x5b45e51240ed42ae858c34a0e7e15003885bd998d3a47da7a4fa5604b69f5c2f\",\"license\":\"GPL-3.0\"},\"contracts/implementations/mainnet/AngleRouterMainnet.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"../../interfaces/IFeeDistributorFront.sol\\\";\\nimport \\\"../../interfaces/ISanToken.sol\\\";\\nimport \\\"../../interfaces/IStableMasterFront.sol\\\";\\nimport \\\"../../interfaces/IVeANGLE.sol\\\";\\n\\nimport \\\"../../BaseRouter.sol\\\";\\n\\n// ============================= STRUCTS AND ENUMS =============================\\n\\n/// @notice References to the contracts associated to a collateral for a stablecoin\\nstruct Pairs {\\n IPoolManager poolManager;\\n IPerpetualManagerFrontWithClaim perpetualManager;\\n ISanToken sanToken;\\n ILiquidityGauge gauge;\\n}\\n\\n/// @title AngleRouterMainnet\\n/// @author Angle Core Team\\n/// @notice Router contract built specifially for Angle use cases on Ethereum\\n/// @dev Previous implementation with an initialization function can be found here:\\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\\ncontract AngleRouterMainnet is BaseRouter {\\n using SafeERC20 for IERC20;\\n\\n // =================================== ERRORS ==================================\\n\\n error InvalidParams();\\n\\n // ================================== MAPPINGS =================================\\n\\n /// @notice Maps an agToken to its counterpart `StableMaster`\\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\\n\\n uint256[48] private __gapMainnet;\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @inheritdoc BaseRouter\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\\n if (action == ActionType.claimWeeklyInterest) {\\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\\n } else if (action == ActionType.veANGLEDeposit) {\\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\\n _depositOnLocker(user, amount);\\n }\\n }\\n\\n /// @inheritdoc BaseRouter\\n function _getNativeWrapper() internal pure override returns (IWETH9) {\\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\\n }\\n\\n /// @notice Deposits ANGLE on an existing locker\\n /// @param user Address to deposit for\\n /// @param amount Amount to deposit\\n function _depositOnLocker(address user, uint256 amount) internal {\\n _getVeANGLE().deposit_for(user, amount);\\n }\\n\\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\\n /// @param user Address to claim for\\n /// @param _feeDistributor Address of the fee distributor to claim to\\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\\n /// transfer the token claimed from the `feeDistributor`\\n function _claimWeeklyInterest(\\n address user,\\n IFeeDistributorFront _feeDistributor,\\n bool letInContract\\n ) internal {\\n uint256 amount = _feeDistributor.claim(user);\\n if (letInContract) {\\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\\n IERC20 token = IERC20(_feeDistributor.token());\\n token.safeTransferFrom(msg.sender, address(this), amount);\\n }\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Returns the veANGLE address\\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\\n }\\n}\\n\",\"keccak256\":\"0xbdc4377b1e499260a09fc0f97e76e11f29e9626ad5a75b4ed42bd837ba457b64\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ICoreBorrow.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICoreBorrow\\n/// @author Angle Core Team\\n/// @notice Interface for the `CoreBorrow` contract\\n\\ninterface ICoreBorrow {\\n /// @notice Checks whether an address is governor of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2414539c445977b04bc7e9adac2e5147364994dd74e5d7118b44824956de602c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDepositWithReferral.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IDepositWithReferral\\n/// @author Angle Core Team\\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\\ninterface IDepositWithReferral {\\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\\n /// obtained, the function reverts\\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\\n /// when a deposit takes place\\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut);\\n}\\n\",\"keccak256\":\"0x69b88fa9ec5111394843f54f312c3b8c1b47490c76109a97ba90e4ac5697e960\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IFeeDistributorFront.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title IFeeDistributorFront\\n/// @author Interface for public use of the `FeeDistributor` contract\\n/// @dev This interface is used for user related function\\ninterface IFeeDistributorFront {\\n function token() external returns (address);\\n\\n function claim(address _addr) external returns (uint256);\\n\\n function claim(address[20] memory _addr) external returns (bool);\\n}\\n\",\"keccak256\":\"0xc1e6763b20082160a61c22d51280d20fcf27f72392f954fb0f46e18bee99ec25\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ILiquidityGauge.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface ILiquidityGauge {\\n // solhint-disable-next-line\\n function staking_token() external returns (address stakingToken);\\n\\n // solhint-disable-next-line\\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\\n\\n function deposit(\\n uint256 _value,\\n address _addr,\\n // solhint-disable-next-line\\n bool _claim_rewards\\n ) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr, address _receiver) external;\\n}\\n\",\"keccak256\":\"0x27144c21760603a4e441bb5eecf975ad7f71331ac0ba0a83352b280ccf734756\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IPerpetualManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title Interface of the contract managing perpetuals with claim function\\n/// @author Angle Core Team\\n/// @dev Front interface with rewards function, meaning only user-facing functions\\ninterface IPerpetualManagerFrontWithClaim {\\n function getReward(uint256 perpetualID) external;\\n\\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\\n\\n function openPerpetual(\\n address owner,\\n uint256 amountBrought,\\n uint256 amountCommitted,\\n uint256 maxOracleRate,\\n uint256 minNetMargin\\n ) external returns (uint256 perpetualID);\\n}\\n\",\"keccak256\":\"0x54d0ede0baff0389710f10f63e15a344292beac87f469e0c4df5591b42d9d0d6\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IPoolManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface IPoolManager {\\n function token() external view returns (address);\\n}\\n\",\"keccak256\":\"0xf30d7c68f053ab5c4a559f1bad63d31d8664bc43b063fb559fcb8f41af6935af\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISanToken.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\ninterface ISanToken is IERC20Upgradeable {}\\n\",\"keccak256\":\"0xe40a68e11593cef47a87bfffc95ab5c42f9fc9865a6d590cc7ef0456628b724c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IStableMasterFront.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"./IPoolManager.sol\\\";\\nimport \\\"./ISanToken.sol\\\";\\nimport \\\"./IPerpetualManager.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n// Struct to handle all the parameters to manage the fees\\n// related to a given collateral pool (associated to the stablecoin)\\nstruct MintBurnData {\\n // Values of the thresholds to compute the minting fees\\n // depending on HA hedge (scaled by `BASE_PARAMS`)\\n uint64[] xFeeMint;\\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\\n uint64[] yFeeMint;\\n // Values of the thresholds to compute the burning fees\\n // depending on HA hedge (scaled by `BASE_PARAMS`)\\n uint64[] xFeeBurn;\\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\\n uint64[] yFeeBurn;\\n // Max proportion of collateral from users that can be covered by HAs\\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\\n // the other changes accordingly\\n uint64 targetHAHedge;\\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\\n // to the value of the fees computed using the hedge curve\\n // Scaled by `BASE_PARAMS`\\n uint64 bonusMalusMint;\\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\\n // to the value of the fees computed using the hedge curve\\n // Scaled by `BASE_PARAMS`\\n uint64 bonusMalusBurn;\\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\\n uint256 capOnStableMinted;\\n}\\n\\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\\n// including the fraction of interests they receive or the fees to be distributed to\\n// them\\nstruct SLPData {\\n // Last timestamp at which the `sanRate` has been updated for SLPs\\n uint256 lastBlockUpdated;\\n // Fees accumulated from previous blocks and to be distributed to SLPs\\n uint256 lockedInterests;\\n // Max interests used to update the `sanRate` in a single block\\n // Should be in collateral token base\\n uint256 maxInterestsDistributed;\\n // Amount of fees left aside for SLPs and that will be distributed\\n // when the protocol is collateralized back again\\n uint256 feesAside;\\n // Part of the fees normally going to SLPs that is left aside\\n // before the protocol is collateralized back again (depends on collateral ratio)\\n // Updated by keepers and scaled by `BASE_PARAMS`\\n uint64 slippageFee;\\n // Portion of the fees from users minting and burning\\n // that goes to SLPs (the rest goes to surplus)\\n uint64 feesForSLPs;\\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\\n // Updated by keepers and scaled by `BASE_PARAMS`\\n uint64 slippage;\\n // Portion of the interests from lending\\n // that goes to SLPs (the rest goes to surplus)\\n uint64 interestsForSLPs;\\n}\\n\\n/// @title IStableMasterFront\\n/// @author Angle Core Team\\n/// @dev Front interface, meaning only user-facing functions\\ninterface IStableMasterFront {\\n function collateralMap(IPoolManager poolManager)\\n external\\n view\\n returns (\\n IERC20 token,\\n ISanToken sanToken,\\n IPerpetualManagerFrontWithClaim perpetualManager,\\n address oracle,\\n uint256 stocksUsers,\\n uint256 sanRate,\\n uint256 collatBase,\\n SLPData memory slpData,\\n MintBurnData memory feeData\\n );\\n\\n function updateStocksUsers(uint256 amount, address poolManager) external;\\n\\n function mint(\\n uint256 amount,\\n address user,\\n IPoolManager poolManager,\\n uint256 minStableAmount\\n ) external;\\n\\n function burn(\\n uint256 amount,\\n address burner,\\n address dest,\\n IPoolManager poolManager,\\n uint256 minCollatAmount\\n ) external;\\n\\n function deposit(\\n uint256 amount,\\n address user,\\n IPoolManager poolManager\\n ) external;\\n\\n function withdraw(\\n uint256 amount,\\n address burner,\\n address dest,\\n IPoolManager poolManager\\n ) external;\\n\\n function agToken() external returns (address);\\n}\\n\",\"keccak256\":\"0xa6028e759a212da7e32f8414f4e6356474d381a725b09cec3adcb46bf5335b74\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\n/// @title ISwapper\\n/// @author Angle Core Team\\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\\ninterface ISwapper {\\n function swap(\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0x506f50d8447c2dc662bd844779cc66a407af07a91210612b956ef47abcc15776\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITreasury.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ITreasury\\n/// @author Angle Core Team\\n/// @notice Interface for the `Treasury` contract\\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\\n/// of this module\\ninterface ITreasury {\\n /// @notice Checks whether a given address has well been initialized in this contract\\n /// as a `VaultManager``\\n /// @param _vaultManager Address to check\\n /// @return Whether the address has been initialized or not\\n function isVaultManager(address _vaultManager) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x36bd50a0ab1c46503bb64b8d5777bf3b4fd2da0e2dcfe68c8a9702eb132eb3e2\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVaultManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./ITreasury.sol\\\";\\n\\n// ========================= Key Structs and Enums =============================\\n\\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\\n/// to the caller or associated addresses\\nstruct PaymentData {\\n // Stablecoin amount the contract should give\\n uint256 stablecoinAmountToGive;\\n // Stablecoin amount owed to the contract\\n uint256 stablecoinAmountToReceive;\\n // Collateral amount the contract should give\\n uint256 collateralAmountToGive;\\n // Collateral amount owed to the contract\\n uint256 collateralAmountToReceive;\\n}\\n\\n/// @notice Data stored to track someone's loan (or equivalently called position)\\nstruct Vault {\\n // Amount of collateral deposited in the vault\\n uint256 collateralAmount;\\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\\n uint256 normalizedDebt;\\n}\\n\\n/// @notice Actions possible when composing calls to the different entry functions proposed\\nenum ActionBorrowType {\\n createVault,\\n closeVault,\\n addCollateral,\\n removeCollateral,\\n repayDebt,\\n borrow,\\n getDebtIn,\\n permit\\n}\\n\\n// ========================= Interfaces =============================\\n\\n/// @title IVaultManagerFunctions\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface only contains functions of the contract which are called by other contracts\\n/// of this module (without getters)\\ninterface IVaultManagerFunctions {\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\\n /// @param repayData Data to pass to the repayment contract in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to,\\n address who,\\n bytes memory repayData\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Checks whether a given address is approved for a vault or owns this vault\\n /// @param spender Address for which vault ownership should be checked\\n /// @param vaultID ID of the vault to check\\n /// @return Whether the `spender` address owns or is approved for `vaultID`\\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\\n\\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\\n /// @param spender Address to give approval to\\n /// @param approved Whether to give or revoke the approval\\n /// @param deadline Deadline parameter for the signature to be valid\\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\\n function permit(\\n address owner,\\n address spender,\\n bool approved,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\\n/// @title IVaultManagerStorage\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface contains getters of the contract's public variables used by other contracts\\n/// of this module\\ninterface IVaultManagerStorage {\\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\\n function treasury() external view returns (ITreasury);\\n\\n /// @notice Reference to the collateral handled by this `VaultManager`\\n function collateral() external view returns (IERC20);\\n\\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\\n function vaultIDCount() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4cf6dc5e5b494165e4d9e524dca5c65f6307e5b005a62287c5e84f1539dc81f1\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVeANGLE.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\\\";\\n\\n/// @title IVeANGLE\\n/// @author Angle Core Team\\n/// @notice Interface for the `VeANGLE` contract\\ninterface IVeANGLE {\\n // solhint-disable-next-line func-name-mixedcase\\n function deposit_for(address addr, uint256 amount) external;\\n}\\n\",\"keccak256\":\"0x6910638a6b2cdadb367431626e4ab0caec6edb160e69f0cadb5fa411be5c51dd\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title Interface for WETH9\\ninterface IWETH9 is IERC20 {\\n /// @notice Deposit ether to get wrapped ether\\n function deposit() external payable;\\n\\n /// @notice Withdraw wrapped ether to get ether\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0xb109c1d668416c05f61d6edea2ec7a10b2f8b386fd51a59cc12f929c73d00424\",\"license\":\"GPL-2.0-or-later\"},\"contracts/interfaces/external/uniswap/IUniswapRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nstruct ExactInputParams {\\n bytes path;\\n address recipient;\\n uint256 deadline;\\n uint256 amountIn;\\n uint256 amountOutMinimum;\\n}\\n\\n/// @title Router token swapping functionality\\n/// @notice Functions for swapping tokens via Uniswap V3\\ninterface IUniswapV3Router {\\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\\n /// @return amountOut The amount of the received token\\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\\n}\\n\\n/// @title Router for price estimation functionality\\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\\n/// @dev This interface is only used for non critical elements of the protocol\\ninterface IUniswapV2Router {\\n /// @notice Given an input asset amount, returns the maximum output amount of the\\n /// other asset (accounting for fees) given reserves.\\n /// @param path Addresses of the pools used to get prices\\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\\n\\n function swapExactTokensForTokens(\\n uint256 swapAmount,\\n uint256 minExpected,\\n address[] calldata path,\\n address receiver,\\n uint256 swapDeadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x1908fcdc6ff78ad2250f6ccacc7129df464a648cb2a5f376bedbe506d058bb73\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620019d91760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b61434a806200015c6000396000f3fe6080604052600436106100cb5760003560e01c80638000963011610074578063b80344241161004e578063b8034424146102bc578063b82c4dc1146102ff578063f2f4eb261461031f57600080fd5b8063800096301461026957806383f1d68114610289578063848c48da146102a957600080fd5b806342860d4b116100a557806342860d4b1461018957806359856d56146101ab5780637c295dfa146101be57600080fd5b8063045c08d5146100d75780632c76d7a61461012e57806340c7c4ed1461015b57600080fd5b366100d257005b600080fd5b3480156100e357600080fd5b506002546101049073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561013a57600080fd5b506001546101049073ffffffffffffffffffffffffffffffffffffffff1681565b34801561016757600080fd5b5061017b610176366004613285565b610352565b604051908152602001610125565b34801561019557600080fd5b506101a96101a43660046132f5565b6103b9565b005b6101a96101b9366004613555565b610624565b3480156101ca57600080fd5b506102296101d93660046136db565b6033602090815260009283526040808420909152908252902080546001820154600283015460039093015473ffffffffffffffffffffffffffffffffffffffff9283169391831692918216911684565b6040805173ffffffffffffffffffffffffffffffffffffffff95861681529385166020850152918416918301919091529091166060820152608001610125565b34801561027557600080fd5b506101a9610284366004613714565b6109c0565b34801561029557600080fd5b506101a96102a4366004613731565b610b72565b6101a96102b7366004613766565b610d22565b3480156102c857600080fd5b506101046102d7366004613714565b60326020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561030b57600080fd5b506101a961031a3660046137fb565b61183b565b34801561032b57600080fd5b506000546101049062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061037673ffffffffffffffffffffffffffffffffffffffff88163330886119f5565b6103a187877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b6103ae8686868686611c0f565b979650505050505050565b600054610100900460ff16158080156103d95750600054600160ff909116105b806103f35750303b1580156103f3575060005460ff166001145b610484576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156104e257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661052f576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561061e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156107ec5787818151811061064357610643613876565b602002602001015160400151156107d75787818151811061066657610666613876565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061069f5761069f613876565b6020026020010151602001513060018c86815181106106c0576106c0613876565b6020026020010151606001518d87815181106106de576106de613876565b6020026020010151608001518e88815181106106fc576106fc613876565b602002602001015160a001518f898151811061071a5761071a613876565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156107ba57600080fd5b505af11580156107ce573d6000803e3d6000fd5b505050506107dc565b6107ec565b6107e5816138d4565b9050610629565b506107fa8686868686610d22565b60005b818110156109b65787818151811061081757610817613876565b6020026020010151604001516109a65787818151811061083957610839613876565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061087257610872613876565b6020026020010151602001513060008c868151811061089357610893613876565b6020026020010151606001518d87815181106108b1576108b1613876565b6020026020010151608001518e88815181106108cf576108cf613876565b602002602001015160a001518f89815181106108ed576108ed613876565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561098d57600080fd5b505af11580156109a1573d6000803e3d6000fd5b505050505b6109af816138d4565b90506107fd565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa158015610a33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a57919061390c565b1580610aee57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec919061390c565b155b15610b25576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c09919061390c565b610c3f576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610c8c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610cdd576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610eda57868181518110610d4157610d41613876565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610d7a57610d7a613876565b602002602001015160200151308a8581518110610d9957610d99613876565b6020026020010151604001518b8681518110610db757610db7613876565b6020026020010151606001518c8781518110610dd557610dd5613876565b6020026020010151608001518d8881518110610df357610df3613876565b602002602001015160a001518e8981518110610e1157610e11613876565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610eb157600080fd5b505af1158015610ec5573d6000803e3d6000fd5b5050505080610ed3906138d4565b9050610d27565b508360005b818110156109b6576000878783818110610efb57610efb613876565b9050602002016020810190610f109190613958565b601b811115610f2157610f21613929565b03611044576000806000878785818110610f3d57610f3d613876565b9050602002810190610f4f9190613979565b810190610f5c91906139e9565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810361101a576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610ff3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110179190613a2a565b90505b61103c73ffffffffffffffffffffffffffffffffffffffff84163384846119f5565b50505061182b565b600187878381811061105857611058613876565b905060200201602081019061106d9190613958565b601b81111561107e5761107e613929565b036110915761108b611c8a565b5061182b565b60028787838181106110a5576110a5613876565b90506020020160208101906110ba9190613958565b601b8111156110cb576110cb613929565b03611112576000808686848181106110e5576110e5613876565b90506020028101906110f79190613979565b8101906111049190613a43565b9150915061103c8282611d07565b600387878381811061112657611126613876565b905060200201602081019061113b9190613958565b601b81111561114c5761114c613929565b0361119857600080600087878581811061116857611168613876565b905060200281019061117a9190613979565b8101906111879190613a68565b92509250925061103c838383611e4e565b60048787838181106111ac576111ac613876565b90506020020160208101906111c19190613958565b601b8111156111d2576111d2613929565b036111e85747801561108b5761108b3382611f12565b60068787838181106111fc576111fc613876565b90506020020160208101906112119190613958565b601b81111561122257611222613929565b0361127757600080600087878581811061123e5761123e613876565b90506020028101906112509190613979565b81019061125d9190613b2d565b92509250925061126e838383611f5c565b5050505061182b565b600787878381811061128b5761128b613876565b90506020020160208101906112a09190613958565b601b8111156112b1576112b1613929565b036112ff576000808686848181106112cb576112cb613876565b90506020028101906112dd9190613979565b8101906112ea9190613b86565b915091506112f8828261204a565b505061182b565b600987878381811061131357611313613876565b90506020020160208101906113289190613958565b601b81111561133957611339613929565b036113dc5760008060008060008060008b8b8981811061135b5761135b613876565b905060200281019061136d9190613979565b81019061137a9190613d29565b96509650965096509650965096506113948383888a612107565b91506113c187877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b6113cf868484888886612634565b505050505050505061182b565b600a8787838181106113f0576113f0613876565b90506020020160208101906114059190613958565b601b81111561141657611416613929565b036114805760008060008060008060008b8b8981811061143857611438613876565b905060200281019061144a9190613979565b8101906114579190613df8565b9650965096509650965096509650611474878787878787876126fe565b5050505050505061182b565b600b87878381811061149457611494613876565b90506020020160208101906114a99190613958565b601b8111156114ba576114ba613929565b036115445760008060008060008989878181106114d9576114d9613876565b90506020028101906114eb9190613979565b8101906114f89190613e84565b9450945094509450945061152d85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b61153984848484612795565b50505050505061182b565b600c87878381811061155857611558613876565b905060200201602081019061156d9190613958565b601b81111561157e5761157e613929565b036115fd57600080600080600089898781811061159d5761159d613876565b90506020028101906115af9190613979565b8101906115bc9190613e84565b945094509450945094506115f185857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b61153984848484612841565b601b87878381811061161157611611613876565b90506020020160208101906116269190613958565b601b81111561163757611637613929565b036116ba576000806000806000808a8a8881811061165757611657613876565b90506020028101906116699190613979565b8101906116769190613285565b9550955095509550955095506116ad86867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b6114748585858585611c0f565b600d8787838181106116ce576116ce613876565b90506020020160208101906116e39190613958565b601b8111156116f4576116f4613929565b0361174e5760008060008088888681811061171157611711613876565b90506020028101906117239190613979565b8101906117309190613edf565b9350935093509350611744848484846128eb565b505050505061182b565b600e87878381811061176257611762613876565b90506020020160208101906117779190613958565b601b81111561178857611788613929565b036117d8576000806000808888868181106117a5576117a5613876565b90506020028101906117b79190613979565b8101906117c49190613edf565b935093509350935061174484848484612953565b61182b8787838181106117ed576117ed613876565b90506020020160208101906118029190613958565b86868481811061181457611814613876565b90506020028101906118269190613979565b6129be565b611834816138d4565b9050610edf565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156118ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118d2919061390c565b611908576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806119185750808214155b1561194f576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156109b6576119c988888381811061196f5761196f613876565b90506020020160208101906119849190613714565b87878481811061199657611996613876565b90506020020160208101906119ab9190613714565b8686858181106119bd576119bd613876565b90506020020135611ad1565b6119d2816138d4565b9050611952565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261061e9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612a3d565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611b47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6b9190613a2a565b90508181108015611ba55750611ba260027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613f27565b81105b15611bdb57611bd683611bb88385613f62565b73ffffffffffffffffffffffffffffffffffffffff87169190612b49565b61061e565b8181111561061e5761061e83611bf18484613f62565b73ffffffffffffffffffffffffffffffffffffffff87169190612c47565b6000611c1d86868686612841565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611ce857600080fd5b505af1158015611cfc573d6000803e3d6000fd5b505050505034905090565b600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611d8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dae9190613a2a565b9050611dba8184612dcd565b8015611e48576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d90602401600060405180830381600087803b158015611e2657600080fd5b505af1158015611e3a573d6000803e3d6000fd5b50505050611e488282611f12565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611ebb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611edf9190613a2a565b9050611eeb8184612dcd565b801561061e5761061e73ffffffffffffffffffffffffffffffffffffffff85168383612e07565b600080600080600085875af1905080611f57576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b60025460009073ffffffffffffffffffffffffffffffffffffffff16611fa385827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611fcb9190613f99565b6000604051808303816000865af19150503d8060008114612008576040519150601f19603f3d011682016040523d82523d6000602084013e61200d565b606091505b5091509150816120205761202081612e5d565b808060200190518101906120349190613a2a565b93506120408487612dcd565b5050509392505050565b805160005b8181101561061e5782818151811061206957612069613876565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b1580156120de57600080fd5b505af11580156120f2573d6000803e3d6000fd5b5050505080612100906138d4565b905061204f565b835160609060008167ffffffffffffffff81111561212757612127613340565b604051908082528060200260200182016040528015612150578160200160208202803683370190505b5090506000806000805b85811015612622576000808c838151811061217757612177613876565b6020026020010151600781111561219057612190613929565b0361219f576001945050612612565b60028c83815181106121b3576121b3613876565b602002602001015160078111156121cc576121cc613929565b036122e35760008b83815181106121e5576121e5613876565b60200260200101518060200190518101906122009190613fb5565b9092509050600181016122dc576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229d9190613a2a565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106122d0576122d0613876565b60200260200101819052505b5050612612565b60038c83815181106122f7576122f7613876565b6020026020010151600781111561231057612310613929565b1480612346575060058c838151811061232b5761232b613876565b6020026020010151600781111561234457612344613929565b145b15612380578a828151811061235d5761235d613876565b60200260200101518060200190518101906123789190613fb5565b509050612457565b60018c838151811061239457612394613876565b602002602001015160078111156123ad576123ad613929565b036123e6578a82815181106123c4576123c4613876565b60200260200101518060200190518101906123df9190613a2a565b9050612457565b60068c83815181106123fa576123fa613876565b6020026020010151600781111561241357612413613929565b03612451578a828151811061242a5761242a613876565b60200260200101518060200190518101906124459190613fd9565b50919250612457915050565b50612612565b806000036124e857841561246b5750612612565b836000036124e5578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e29190613a2a565b93505b50825b60005b83811015612519578187828151811061250657612506613876565b505050612512816138d4565b90506124eb565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa15801561258b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125af919061390c565b6125e5576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106125f8576125f8613876565b602090810291909101015261260e600184614017565b9250505b61261b816138d4565b905061215a565b5088955050505050505b949350505050565b61265f6040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906126bb908990899033908a908a908a906004016140b9565b6080604051808303816000875af11580156126da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ae91906141b9565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061275a9089908990899089908990899060040161421f565b600060405180830381600087803b15801561277457600080fd5b505af1158015612788573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161262c918491908816906394bf804d906044015b6020604051808303816000875af1158015612815573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128399190613a2a565b925082612dcd565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161262c91871690636e553f65906044015b6020604051808303816000875af11580156128be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128e29190613a2a565b91508183612dcd565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015233604483015260009161262c9187169063ba0876529060640161289f565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015233604483015260009161262c9184919088169063b460af94906064016127f6565b601383601b8111156129d2576129d2613929565b03612a0057600080806129e784860186614278565b9250925092506129f8838383612e9e565b505050505050565b601983601b811115612a1457612a14613929565b03611f5757600080612a28838501856142b8565b91509150612a368282612fd3565b5050505050565b6000612a9f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661306e9092919063ffffffff16565b805190915015611f575780806020019051810190612abd919061390c565b611f57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161047b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612bc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612be49190613a2a565b612bee9190614017565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061061e9085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611a4f565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612cbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ce19190613a2a565b905081811015612d73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f0000000000000000000000000000000000000000000000606482015260840161047b565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612a369086907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611a4f565b80821015610d1e576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611f579084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611a4f565b805115612e6c57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f1e83409a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015260009190841690631e83409a906024016020604051808303816000875af1158015612f10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f349190613a2a565b9050811561061e5760008373ffffffffffffffffffffffffffffffffffffffff1663fc0c546a6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612f8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612faf91906142e4565b9050612a3673ffffffffffffffffffffffffffffffffffffffff82163330856119f5565b730c462dbb9ec8cd1630f1728b2cfd2769d09f0dd56040517f3a46273e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018490529190911690633a46273e90604401600060405180830381600087803b15801561305a57600080fd5b505af11580156129f8573d6000803e3d6000fd5b606061307d8484600085613087565b90505b9392505050565b606082471015613119576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161047b565b73ffffffffffffffffffffffffffffffffffffffff85163b613197576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161047b565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516131c09190613f99565b60006040518083038185875af1925050503d80600081146131fd576040519150601f19603f3d011682016040523d82523d6000602084013e613202565b606091505b50915091506103ae8282866060831561321c575081613080565b82511561322c5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047b9190614301565b73ffffffffffffffffffffffffffffffffffffffff8116811461328257600080fd5b50565b60008060008060008060c0878903121561329e57600080fd5b86356132a981613260565b955060208701356132b981613260565b94506040870135935060608701356132d081613260565b92506080870135915060a08701356132e781613260565b809150509295509295509295565b60008060006060848603121561330a57600080fd5b833561331581613260565b9250602084013561332581613260565b9150604084013561333581613260565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561339257613392613340565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156133df576133df613340565b604052919050565b600067ffffffffffffffff82111561340157613401613340565b5060051b60200190565b801515811461328257600080fd5b803560ff8116811461342a57600080fd5b919050565b600082601f83011261344057600080fd5b81356020613455613450836133e7565b613398565b82815260e0928302850182019282820191908785111561347457600080fd5b8387015b858110156134fc5781818a0312156134905760008081fd5b61349861336f565b81356134a381613260565b8152818601356134b281613260565b81870152604082810135908201526060808301359082015260806134d7818401613419565b9082015260a0828101359082015260c080830135908201528452928401928101613478565b5090979650505050505050565b60008083601f84011261351b57600080fd5b50813567ffffffffffffffff81111561353357600080fd5b6020830191508360208260051b850101111561354e57600080fd5b9250929050565b6000806000806000806080878903121561356e57600080fd5b863567ffffffffffffffff8082111561358657600080fd5b818901915089601f83011261359a57600080fd5b813560206135aa613450836133e7565b82815260e09092028401810191818101908d8411156135c857600080fd5b948201945b8386101561365f5760e0868f0312156135e65760008081fd5b6135ee61336f565b86356135f981613260565b81528684013561360881613260565b8185015260408781013561361b8161340b565b908201526060878101359082015261363560808801613419565b608082015260a0878101359082015260c08088013590820152825260e090950194908201906135cd565b9a50508a01359250508082111561367557600080fd5b6136818a838b0161342f565b9650604089013591508082111561369757600080fd5b6136a38a838b01613509565b909650945060608901359150808211156136bc57600080fd5b506136c989828a01613509565b979a9699509497509295939492505050565b600080604083850312156136ee57600080fd5b82356136f981613260565b9150602083013561370981613260565b809150509250929050565b60006020828403121561372657600080fd5b813561308081613260565b6000806040838503121561374457600080fd5b823561374f81613260565b915061375d60208401613419565b90509250929050565b60008060008060006060868803121561377e57600080fd5b853567ffffffffffffffff8082111561379657600080fd5b6137a289838a0161342f565b965060208801359150808211156137b857600080fd5b6137c489838a01613509565b909650945060408801359150808211156137dd57600080fd5b506137ea88828901613509565b969995985093965092949392505050565b6000806000806000806060878903121561381457600080fd5b863567ffffffffffffffff8082111561382c57600080fd5b6138388a838b01613509565b9098509650602089013591508082111561385157600080fd5b61385d8a838b01613509565b909650945060408901359150808211156136bc57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613905576139056138a5565b5060010190565b60006020828403121561391e57600080fd5b81516130808161340b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60006020828403121561396a57600080fd5b8135601c811061308057600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126139ae57600080fd5b83018035915067ffffffffffffffff8211156139c957600080fd5b60200191503681900382131561354e57600080fd5b803561342a81613260565b6000806000606084860312156139fe57600080fd5b8335613a0981613260565b92506020840135613a1981613260565b929592945050506040919091013590565b600060208284031215613a3c57600080fd5b5051919050565b60008060408385031215613a5657600080fd5b82359150602083013561370981613260565b600080600060608486031215613a7d57600080fd5b8335613a8881613260565b925060208401359150604084013561333581613260565b600082601f830112613ab057600080fd5b813567ffffffffffffffff811115613aca57613aca613340565b613afb60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613398565b818152846020838601011115613b1057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215613b4257600080fd5b8335613b4d81613260565b925060208401359150604084013567ffffffffffffffff811115613b7057600080fd5b613b7c86828701613a9f565b9150509250925092565b60008060408385031215613b9957600080fd5b8235613ba481613260565b915060208381013567ffffffffffffffff811115613bc157600080fd5b8401601f81018613613bd257600080fd5b8035613be0613450826133e7565b81815260059190911b82018301908381019088831115613bff57600080fd5b928401925b82841015613c26578335613c1781613260565b82529284019290840190613c04565b80955050505050509250929050565b600082601f830112613c4657600080fd5b81356020613c56613450836133e7565b82815260059290921b84018101918181019086841115613c7557600080fd5b8286015b84811015613c9e57803560088110613c915760008081fd5b8352918301918301613c79565b509695505050505050565b600082601f830112613cba57600080fd5b81356020613cca613450836133e7565b82815260059290921b84018101918181019086841115613ce957600080fd5b8286015b84811015613c9e57803567ffffffffffffffff811115613d0d5760008081fd5b613d1b8986838b0101613a9f565b845250918301918301613ced565b600080600080600080600060e0888a031215613d4457600080fd5b8735613d4f81613260565b96506020880135613d5f81613260565b9550613d6d604089016139de565b9450613d7b606089016139de565b9350608088013567ffffffffffffffff80821115613d9857600080fd5b613da48b838c01613c35565b945060a08a0135915080821115613dba57600080fd5b613dc68b838c01613ca9565b935060c08a0135915080821115613ddc57600080fd5b50613de98a828b01613a9f565b91505092959891949750929550565b600080600080600080600060e0888a031215613e1357600080fd5b8735613e1e81613260565b96506020880135613e2e81613260565b95506040880135613e3e81613260565b94506060880135613e4e81613260565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613e7857600080fd5b613de98a828b01613a9f565b600080600080600060a08688031215613e9c57600080fd5b8535613ea781613260565b94506020860135613eb781613260565b9350604086013592506060860135613ece81613260565b949793965091946080013592915050565b60008060008060808587031215613ef557600080fd5b8435613f0081613260565b9350602085013592506040850135613f1781613260565b9396929550929360600135925050565b600082613f5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611e4857611e486138a5565b60005b83811015613f90578181015183820152602001613f78565b50506000910152565b60008251613fab818460208701613f75565b9190910192915050565b60008060408385031215613fc857600080fd5b505080516020909101519092909150565b60008060008060808587031215613fef57600080fd5b84519350602085015161400181613260565b6040860151606090960151949790965092505050565b80820180821115611e4857611e486138a5565b60008151808452614042816020860160208601613f75565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000815180845260208085019450848260051b860182860160005b858110156134fc5783830389526140a783835161402a565b9885019892509084019060010161408f565b60c0808252875190820181905260009060209060e0840190828b0184805b8381101561412857825160088110614116577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b855293850193918501916001016140d7565b505050508381038285015261413d818a614074565b915050614162604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a08401526141ac818561402a565b9998505050505050505050565b6000608082840312156141cb57600080fd5b6040516080810181811067ffffffffffffffff821117156141ee576141ee613340565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a083015261426c60c083018461402a565b98975050505050505050565b60008060006060848603121561428d57600080fd5b833561429881613260565b925060208401356142a881613260565b915060408401356133358161340b565b600080604083850312156142cb57600080fd5b82356142d681613260565b946020939093013593505050565b6000602082840312156142f657600080fd5b815161308081613260565b602081526000613080602083018461402a56fea2646970667358221220c3a78ab9ffbbdabd4f0ad18a672ac65a721280c80797004fdec97bbebfdc5d7f64736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100cb5760003560e01c80638000963011610074578063b80344241161004e578063b8034424146102bc578063b82c4dc1146102ff578063f2f4eb261461031f57600080fd5b8063800096301461026957806383f1d68114610289578063848c48da146102a957600080fd5b806342860d4b116100a557806342860d4b1461018957806359856d56146101ab5780637c295dfa146101be57600080fd5b8063045c08d5146100d75780632c76d7a61461012e57806340c7c4ed1461015b57600080fd5b366100d257005b600080fd5b3480156100e357600080fd5b506002546101049073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561013a57600080fd5b506001546101049073ffffffffffffffffffffffffffffffffffffffff1681565b34801561016757600080fd5b5061017b610176366004613285565b610352565b604051908152602001610125565b34801561019557600080fd5b506101a96101a43660046132f5565b6103b9565b005b6101a96101b9366004613555565b610624565b3480156101ca57600080fd5b506102296101d93660046136db565b6033602090815260009283526040808420909152908252902080546001820154600283015460039093015473ffffffffffffffffffffffffffffffffffffffff9283169391831692918216911684565b6040805173ffffffffffffffffffffffffffffffffffffffff95861681529385166020850152918416918301919091529091166060820152608001610125565b34801561027557600080fd5b506101a9610284366004613714565b6109c0565b34801561029557600080fd5b506101a96102a4366004613731565b610b72565b6101a96102b7366004613766565b610d22565b3480156102c857600080fd5b506101046102d7366004613714565b60326020526000908152604090205473ffffffffffffffffffffffffffffffffffffffff1681565b34801561030b57600080fd5b506101a961031a3660046137fb565b61183b565b34801561032b57600080fd5b506000546101049062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061037673ffffffffffffffffffffffffffffffffffffffff88163330886119f5565b6103a187877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b6103ae8686868686611c0f565b979650505050505050565b600054610100900460ff16158080156103d95750600054600160ff909116105b806103f35750303b1580156103f3575060005460ff166001145b610484576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156104e257600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661052f576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561061e57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156107ec5787818151811061064357610643613876565b602002602001015160400151156107d75787818151811061066657610666613876565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061069f5761069f613876565b6020026020010151602001513060018c86815181106106c0576106c0613876565b6020026020010151606001518d87815181106106de576106de613876565b6020026020010151608001518e88815181106106fc576106fc613876565b602002602001015160a001518f898151811061071a5761071a613876565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156107ba57600080fd5b505af11580156107ce573d6000803e3d6000fd5b505050506107dc565b6107ec565b6107e5816138d4565b9050610629565b506107fa8686868686610d22565b60005b818110156109b65787818151811061081757610817613876565b6020026020010151604001516109a65787818151811061083957610839613876565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061087257610872613876565b6020026020010151602001513060008c868151811061089357610893613876565b6020026020010151606001518d87815181106108b1576108b1613876565b6020026020010151608001518e88815181106108cf576108cf613876565b602002602001015160a001518f89815181106108ed576108ed613876565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561098d57600080fd5b505af11580156109a1573d6000803e3d6000fd5b505050505b6109af816138d4565b90506107fd565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa158015610a33573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610a57919061390c565b1580610aee57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa158015610ac8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610aec919061390c565b155b15610b25576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610be5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610c09919061390c565b610c3f576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610c8c576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610cdd576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610eda57868181518110610d4157610d41613876565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610d7a57610d7a613876565b602002602001015160200151308a8581518110610d9957610d99613876565b6020026020010151604001518b8681518110610db757610db7613876565b6020026020010151606001518c8781518110610dd557610dd5613876565b6020026020010151608001518d8881518110610df357610df3613876565b602002602001015160a001518e8981518110610e1157610e11613876565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610eb157600080fd5b505af1158015610ec5573d6000803e3d6000fd5b5050505080610ed3906138d4565b9050610d27565b508360005b818110156109b6576000878783818110610efb57610efb613876565b9050602002016020810190610f109190613958565b601b811115610f2157610f21613929565b03611044576000806000878785818110610f3d57610f3d613876565b9050602002810190610f4f9190613979565b810190610f5c91906139e9565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff810361101a576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610ff3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110179190613a2a565b90505b61103c73ffffffffffffffffffffffffffffffffffffffff84163384846119f5565b50505061182b565b600187878381811061105857611058613876565b905060200201602081019061106d9190613958565b601b81111561107e5761107e613929565b036110915761108b611c8a565b5061182b565b60028787838181106110a5576110a5613876565b90506020020160208101906110ba9190613958565b601b8111156110cb576110cb613929565b03611112576000808686848181106110e5576110e5613876565b90506020028101906110f79190613979565b8101906111049190613a43565b9150915061103c8282611d07565b600387878381811061112657611126613876565b905060200201602081019061113b9190613958565b601b81111561114c5761114c613929565b0361119857600080600087878581811061116857611168613876565b905060200281019061117a9190613979565b8101906111879190613a68565b92509250925061103c838383611e4e565b60048787838181106111ac576111ac613876565b90506020020160208101906111c19190613958565b601b8111156111d2576111d2613929565b036111e85747801561108b5761108b3382611f12565b60068787838181106111fc576111fc613876565b90506020020160208101906112119190613958565b601b81111561122257611222613929565b0361127757600080600087878581811061123e5761123e613876565b90506020028101906112509190613979565b81019061125d9190613b2d565b92509250925061126e838383611f5c565b5050505061182b565b600787878381811061128b5761128b613876565b90506020020160208101906112a09190613958565b601b8111156112b1576112b1613929565b036112ff576000808686848181106112cb576112cb613876565b90506020028101906112dd9190613979565b8101906112ea9190613b86565b915091506112f8828261204a565b505061182b565b600987878381811061131357611313613876565b90506020020160208101906113289190613958565b601b81111561133957611339613929565b036113dc5760008060008060008060008b8b8981811061135b5761135b613876565b905060200281019061136d9190613979565b81019061137a9190613d29565b96509650965096509650965096506113948383888a612107565b91506113c187877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b6113cf868484888886612634565b505050505050505061182b565b600a8787838181106113f0576113f0613876565b90506020020160208101906114059190613958565b601b81111561141657611416613929565b036114805760008060008060008060008b8b8981811061143857611438613876565b905060200281019061144a9190613979565b8101906114579190613df8565b9650965096509650965096509650611474878787878787876126fe565b5050505050505061182b565b600b87878381811061149457611494613876565b90506020020160208101906114a99190613958565b601b8111156114ba576114ba613929565b036115445760008060008060008989878181106114d9576114d9613876565b90506020028101906114eb9190613979565b8101906114f89190613e84565b9450945094509450945061152d85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b61153984848484612795565b50505050505061182b565b600c87878381811061155857611558613876565b905060200201602081019061156d9190613958565b601b81111561157e5761157e613929565b036115fd57600080600080600089898781811061159d5761159d613876565b90506020028101906115af9190613979565b8101906115bc9190613e84565b945094509450945094506115f185857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b61153984848484612841565b601b87878381811061161157611611613876565b90506020020160208101906116269190613958565b601b81111561163757611637613929565b036116ba576000806000806000808a8a8881811061165757611657613876565b90506020028101906116699190613979565b8101906116769190613285565b9550955095509550955095506116ad86867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b6114748585858585611c0f565b600d8787838181106116ce576116ce613876565b90506020020160208101906116e39190613958565b601b8111156116f4576116f4613929565b0361174e5760008060008088888681811061171157611711613876565b90506020028101906117239190613979565b8101906117309190613edf565b9350935093509350611744848484846128eb565b505050505061182b565b600e87878381811061176257611762613876565b90506020020160208101906117779190613958565b601b81111561178857611788613929565b036117d8576000806000808888868181106117a5576117a5613876565b90506020028101906117b79190613979565b8101906117c49190613edf565b935093509350935061174484848484612953565b61182b8787838181106117ed576117ed613876565b90506020020160208101906118029190613958565b86868481811061181457611814613876565b90506020028101906118269190613979565b6129be565b611834816138d4565b9050610edf565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156118ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906118d2919061390c565b611908576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806119185750808214155b1561194f576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156109b6576119c988888381811061196f5761196f613876565b90506020020160208101906119849190613714565b87878481811061199657611996613876565b90506020020160208101906119ab9190613714565b8686858181106119bd576119bd613876565b90506020020135611ad1565b6119d2816138d4565b9050611952565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261061e9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff0000000000000000000000000000000000000000000000000000000090931692909217909152612a3d565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611b47573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611b6b9190613a2a565b90508181108015611ba55750611ba260027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613f27565b81105b15611bdb57611bd683611bb88385613f62565b73ffffffffffffffffffffffffffffffffffffffff87169190612b49565b61061e565b8181111561061e5761061e83611bf18484613f62565b73ffffffffffffffffffffffffffffffffffffffff87169190612c47565b6000611c1d86868686612841565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc273ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611ce857600080fd5b505af1158015611cfc573d6000803e3d6000fd5b505050505034905090565b600073c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611d8a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611dae9190613a2a565b9050611dba8184612dcd565b8015611e48576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc290632e1a7d4d90602401600060405180830381600087803b158015611e2657600080fd5b505af1158015611e3a573d6000803e3d6000fd5b50505050611e488282611f12565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611ebb573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611edf9190613a2a565b9050611eeb8184612dcd565b801561061e5761061e73ffffffffffffffffffffffffffffffffffffffff85168383612e07565b600080600080600085875af1905080611f57576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b505050565b60025460009073ffffffffffffffffffffffffffffffffffffffff16611fa385827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff611ad1565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611fcb9190613f99565b6000604051808303816000865af19150503d8060008114612008576040519150601f19603f3d011682016040523d82523d6000602084013e61200d565b606091505b5091509150816120205761202081612e5d565b808060200190518101906120349190613a2a565b93506120408487612dcd565b5050509392505050565b805160005b8181101561061e5782818151811061206957612069613876565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b1580156120de57600080fd5b505af11580156120f2573d6000803e3d6000fd5b5050505080612100906138d4565b905061204f565b835160609060008167ffffffffffffffff81111561212757612127613340565b604051908082528060200260200182016040528015612150578160200160208202803683370190505b5090506000806000805b85811015612622576000808c838151811061217757612177613876565b6020026020010151600781111561219057612190613929565b0361219f576001945050612612565b60028c83815181106121b3576121b3613876565b602002602001015160078111156121cc576121cc613929565b036122e35760008b83815181106121e5576121e5613876565b60200260200101518060200190518101906122009190613fb5565b9092509050600181016122dc576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612279573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061229d9190613a2a565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106122d0576122d0613876565b60200260200101819052505b5050612612565b60038c83815181106122f7576122f7613876565b6020026020010151600781111561231057612310613929565b1480612346575060058c838151811061232b5761232b613876565b6020026020010151600781111561234457612344613929565b145b15612380578a828151811061235d5761235d613876565b60200260200101518060200190518101906123789190613fb5565b509050612457565b60018c838151811061239457612394613876565b602002602001015160078111156123ad576123ad613929565b036123e6578a82815181106123c4576123c4613876565b60200260200101518060200190518101906123df9190613a2a565b9050612457565b60068c83815181106123fa576123fa613876565b6020026020010151600781111561241357612413613929565b03612451578a828151811061242a5761242a613876565b60200260200101518060200190518101906124459190613fd9565b50919250612457915050565b50612612565b806000036124e857841561246b5750612612565b836000036124e5578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156124be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124e29190613a2a565b93505b50825b60005b83811015612519578187828151811061250657612506613876565b505050612512816138d4565b90506124eb565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa15801561258b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906125af919061390c565b6125e5576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106125f8576125f8613876565b602090810291909101015261260e600184614017565b9250505b61261b816138d4565b905061215a565b5088955050505050505b949350505050565b61265f6040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906126bb908990899033908a908a908a906004016140b9565b6080604051808303816000875af11580156126da573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103ae91906141b9565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061275a9089908990899089908990899060040161421f565b600060405180830381600087803b15801561277457600080fd5b505af1158015612788573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161262c918491908816906394bf804d906044015b6020604051808303816000875af1158015612815573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128399190613a2a565b925082612dcd565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161262c91871690636e553f65906044015b6020604051808303816000875af11580156128be573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128e29190613a2a565b91508183612dcd565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015233604483015260009161262c9187169063ba0876529060640161289f565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015233604483015260009161262c9184919088169063b460af94906064016127f6565b601383601b8111156129d2576129d2613929565b03612a0057600080806129e784860186614278565b9250925092506129f8838383612e9e565b505050505050565b601983601b811115612a1457612a14613929565b03611f5757600080612a28838501856142b8565b91509150612a368282612fd3565b5050505050565b6000612a9f826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff1661306e9092919063ffffffff16565b805190915015611f575780806020019051810190612abd919061390c565b611f57576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f74207375636365656400000000000000000000000000000000000000000000606482015260840161047b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612bc0573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612be49190613a2a565b612bee9190614017565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061061e9085907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611a4f565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612cbd573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612ce19190613a2a565b905081811015612d73576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f0000000000000000000000000000000000000000000000606482015260840161047b565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612a369086907f095ea7b30000000000000000000000000000000000000000000000000000000090606401611a4f565b80821015610d1e576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff8316602482015260448101829052611f579084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611a4f565b805115612e6c57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f1e83409a00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff848116600483015260009190841690631e83409a906024016020604051808303816000875af1158015612f10573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612f349190613a2a565b9050811561061e5760008373ffffffffffffffffffffffffffffffffffffffff1663fc0c546a6040518163ffffffff1660e01b81526004016020604051808303816000875af1158015612f8b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612faf91906142e4565b9050612a3673ffffffffffffffffffffffffffffffffffffffff82163330856119f5565b730c462dbb9ec8cd1630f1728b2cfd2769d09f0dd56040517f3a46273e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8481166004830152602482018490529190911690633a46273e90604401600060405180830381600087803b15801561305a57600080fd5b505af11580156129f8573d6000803e3d6000fd5b606061307d8484600085613087565b90505b9392505050565b606082471015613119576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c0000000000000000000000000000000000000000000000000000606482015260840161047b565b73ffffffffffffffffffffffffffffffffffffffff85163b613197576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161047b565b6000808673ffffffffffffffffffffffffffffffffffffffff1685876040516131c09190613f99565b60006040518083038185875af1925050503d80600081146131fd576040519150601f19603f3d011682016040523d82523d6000602084013e613202565b606091505b50915091506103ae8282866060831561321c575081613080565b82511561322c5782518084602001fd5b816040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161047b9190614301565b73ffffffffffffffffffffffffffffffffffffffff8116811461328257600080fd5b50565b60008060008060008060c0878903121561329e57600080fd5b86356132a981613260565b955060208701356132b981613260565b94506040870135935060608701356132d081613260565b92506080870135915060a08701356132e781613260565b809150509295509295509295565b60008060006060848603121561330a57600080fd5b833561331581613260565b9250602084013561332581613260565b9150604084013561333581613260565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561339257613392613340565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff811182821017156133df576133df613340565b604052919050565b600067ffffffffffffffff82111561340157613401613340565b5060051b60200190565b801515811461328257600080fd5b803560ff8116811461342a57600080fd5b919050565b600082601f83011261344057600080fd5b81356020613455613450836133e7565b613398565b82815260e0928302850182019282820191908785111561347457600080fd5b8387015b858110156134fc5781818a0312156134905760008081fd5b61349861336f565b81356134a381613260565b8152818601356134b281613260565b81870152604082810135908201526060808301359082015260806134d7818401613419565b9082015260a0828101359082015260c080830135908201528452928401928101613478565b5090979650505050505050565b60008083601f84011261351b57600080fd5b50813567ffffffffffffffff81111561353357600080fd5b6020830191508360208260051b850101111561354e57600080fd5b9250929050565b6000806000806000806080878903121561356e57600080fd5b863567ffffffffffffffff8082111561358657600080fd5b818901915089601f83011261359a57600080fd5b813560206135aa613450836133e7565b82815260e09092028401810191818101908d8411156135c857600080fd5b948201945b8386101561365f5760e0868f0312156135e65760008081fd5b6135ee61336f565b86356135f981613260565b81528684013561360881613260565b8185015260408781013561361b8161340b565b908201526060878101359082015261363560808801613419565b608082015260a0878101359082015260c08088013590820152825260e090950194908201906135cd565b9a50508a01359250508082111561367557600080fd5b6136818a838b0161342f565b9650604089013591508082111561369757600080fd5b6136a38a838b01613509565b909650945060608901359150808211156136bc57600080fd5b506136c989828a01613509565b979a9699509497509295939492505050565b600080604083850312156136ee57600080fd5b82356136f981613260565b9150602083013561370981613260565b809150509250929050565b60006020828403121561372657600080fd5b813561308081613260565b6000806040838503121561374457600080fd5b823561374f81613260565b915061375d60208401613419565b90509250929050565b60008060008060006060868803121561377e57600080fd5b853567ffffffffffffffff8082111561379657600080fd5b6137a289838a0161342f565b965060208801359150808211156137b857600080fd5b6137c489838a01613509565b909650945060408801359150808211156137dd57600080fd5b506137ea88828901613509565b969995985093965092949392505050565b6000806000806000806060878903121561381457600080fd5b863567ffffffffffffffff8082111561382c57600080fd5b6138388a838b01613509565b9098509650602089013591508082111561385157600080fd5b61385d8a838b01613509565b909650945060408901359150808211156136bc57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8203613905576139056138a5565b5060010190565b60006020828403121561391e57600080fd5b81516130808161340b565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b60006020828403121561396a57600080fd5b8135601c811061308057600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126139ae57600080fd5b83018035915067ffffffffffffffff8211156139c957600080fd5b60200191503681900382131561354e57600080fd5b803561342a81613260565b6000806000606084860312156139fe57600080fd5b8335613a0981613260565b92506020840135613a1981613260565b929592945050506040919091013590565b600060208284031215613a3c57600080fd5b5051919050565b60008060408385031215613a5657600080fd5b82359150602083013561370981613260565b600080600060608486031215613a7d57600080fd5b8335613a8881613260565b925060208401359150604084013561333581613260565b600082601f830112613ab057600080fd5b813567ffffffffffffffff811115613aca57613aca613340565b613afb60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613398565b818152846020838601011115613b1057600080fd5b816020850160208301376000918101602001919091529392505050565b600080600060608486031215613b4257600080fd5b8335613b4d81613260565b925060208401359150604084013567ffffffffffffffff811115613b7057600080fd5b613b7c86828701613a9f565b9150509250925092565b60008060408385031215613b9957600080fd5b8235613ba481613260565b915060208381013567ffffffffffffffff811115613bc157600080fd5b8401601f81018613613bd257600080fd5b8035613be0613450826133e7565b81815260059190911b82018301908381019088831115613bff57600080fd5b928401925b82841015613c26578335613c1781613260565b82529284019290840190613c04565b80955050505050509250929050565b600082601f830112613c4657600080fd5b81356020613c56613450836133e7565b82815260059290921b84018101918181019086841115613c7557600080fd5b8286015b84811015613c9e57803560088110613c915760008081fd5b8352918301918301613c79565b509695505050505050565b600082601f830112613cba57600080fd5b81356020613cca613450836133e7565b82815260059290921b84018101918181019086841115613ce957600080fd5b8286015b84811015613c9e57803567ffffffffffffffff811115613d0d5760008081fd5b613d1b8986838b0101613a9f565b845250918301918301613ced565b600080600080600080600060e0888a031215613d4457600080fd5b8735613d4f81613260565b96506020880135613d5f81613260565b9550613d6d604089016139de565b9450613d7b606089016139de565b9350608088013567ffffffffffffffff80821115613d9857600080fd5b613da48b838c01613c35565b945060a08a0135915080821115613dba57600080fd5b613dc68b838c01613ca9565b935060c08a0135915080821115613ddc57600080fd5b50613de98a828b01613a9f565b91505092959891949750929550565b600080600080600080600060e0888a031215613e1357600080fd5b8735613e1e81613260565b96506020880135613e2e81613260565b95506040880135613e3e81613260565b94506060880135613e4e81613260565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613e7857600080fd5b613de98a828b01613a9f565b600080600080600060a08688031215613e9c57600080fd5b8535613ea781613260565b94506020860135613eb781613260565b9350604086013592506060860135613ece81613260565b949793965091946080013592915050565b60008060008060808587031215613ef557600080fd5b8435613f0081613260565b9350602085013592506040850135613f1781613260565b9396929550929360600135925050565b600082613f5d577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611e4857611e486138a5565b60005b83811015613f90578181015183820152602001613f78565b50506000910152565b60008251613fab818460208701613f75565b9190910192915050565b60008060408385031215613fc857600080fd5b505080516020909101519092909150565b60008060008060808587031215613fef57600080fd5b84519350602085015161400181613260565b6040860151606090960151949790965092505050565b80820180821115611e4857611e486138a5565b60008151808452614042816020860160208601613f75565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b6000815180845260208085019450848260051b860182860160005b858110156134fc5783830389526140a783835161402a565b9885019892509084019060010161408f565b60c0808252875190820181905260009060209060e0840190828b0184805b8381101561412857825160088110614116577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b855293850193918501916001016140d7565b505050508381038285015261413d818a614074565b915050614162604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a08401526141ac818561402a565b9998505050505050505050565b6000608082840312156141cb57600080fd5b6040516080810181811067ffffffffffffffff821117156141ee576141ee613340565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a083015261426c60c083018461402a565b98975050505050505050565b60008060006060848603121561428d57600080fd5b833561429881613260565b925060208401356142a881613260565b915060408401356133358161340b565b600080604083850312156142cb57600080fd5b82356142d681613260565b946020939093013593505050565b6000602082840312156142f657600080fd5b815161308081613260565b602081526000613080602083018461402a56fea2646970667358221220c3a78ab9ffbbdabd4f0ad18a672ac65a721280c80797004fdec97bbebfdc5d7f64736f6c63430008110033", + "devdoc": { + "author": "Angle Core Team", + "details": "Previous implementation with an initialization function can be found here: https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code", + "kind": "dev", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "params": { + "amounts": "Amounts to allow", + "spenders": "Addresses to allow transfer", + "tokens": "Addresses of the tokens to allow" + } + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens", + "params": { + "actions": "List of actions to be performed by the router (in order of execution)", + "data": "Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored", + "paramsPermit": "Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it" + } + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option", + "params": { + "paramsPermitVaultManager": "Parameters to sign permit to give allowance to the router for a `VaultManager` contract" + } + } + }, + "title": "AngleRouterMainnet", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "notice": "Changes allowances for different tokens" + }, + "core()": { + "notice": "Core address handling access control" + }, + "deposit4626Referral(address,address,uint256,address,uint256,address)": { + "notice": "Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract" + }, + "initializeRouter(address,address,address)": { + "notice": "Deploys the router contract on a chain" + }, + "mapPoolManagers(address,address)": { + "notice": "Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`" + }, + "mapStableMasters(address)": { + "notice": "Maps an agToken to its counterpart `StableMaster`" + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Allows composable calls to different functions within the protocol" + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions" + }, + "oneInch()": { + "notice": "Address of 1Inch router used for swaps" + }, + "setCore(address)": { + "notice": "Sets a new `core` contract" + }, + "setRouter(address,uint8)": { + "notice": "Sets a new router variable" + }, + "uniswapV3Router()": { + "notice": "Address of the router used for swaps" + } + }, + "notice": "Router contract built specifially for Angle use cases on Ethereum", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 9, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 1478, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "core", + "offset": 2, + "slot": "0", + "type": "t_contract(ICoreBorrow)3793" + }, + { + "astId": 1482, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "uniswapV3Router", + "offset": 0, + "slot": "1", + "type": "t_contract(IUniswapV3Router)4262" + }, + { + "astId": 1485, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "oneInch", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 1489, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint256)47_storage" + }, + { + "astId": 3566, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "mapStableMasters", + "offset": 0, + "slot": "50", + "type": "t_mapping(t_contract(IERC20)756,t_contract(IStableMasterFront)4056)" + }, + { + "astId": 3576, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "mapPoolManagers", + "offset": 0, + "slot": "51", + "type": "t_mapping(t_contract(IStableMasterFront)4056,t_mapping(t_contract(IERC20)756,t_struct(Pairs)3550_storage))" + }, + { + "astId": 3580, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "__gapMainnet", + "offset": 0, + "slot": "52", + "type": "t_array(t_uint256)48_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_array(t_uint256)48_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[48]", + "numberOfBytes": "1536" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ICoreBorrow)3793": { + "encoding": "inplace", + "label": "contract ICoreBorrow", + "numberOfBytes": "20" + }, + "t_contract(IERC20)756": { + "encoding": "inplace", + "label": "contract IERC20", + "numberOfBytes": "20" + }, + "t_contract(ILiquidityGauge)3876": { + "encoding": "inplace", + "label": "contract ILiquidityGauge", + "numberOfBytes": "20" + }, + "t_contract(IPerpetualManagerFrontWithClaim)3907": { + "encoding": "inplace", + "label": "contract IPerpetualManagerFrontWithClaim", + "numberOfBytes": "20" + }, + "t_contract(IPoolManager)3915": { + "encoding": "inplace", + "label": "contract IPoolManager", + "numberOfBytes": "20" + }, + "t_contract(ISanToken)3921": { + "encoding": "inplace", + "label": "contract ISanToken", + "numberOfBytes": "20" + }, + "t_contract(IStableMasterFront)4056": { + "encoding": "inplace", + "label": "contract IStableMasterFront", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Router)4262": { + "encoding": "inplace", + "label": "contract IUniswapV3Router", + "numberOfBytes": "20" + }, + "t_mapping(t_contract(IERC20)756,t_contract(IStableMasterFront)4056)": { + "encoding": "mapping", + "key": "t_contract(IERC20)756", + "label": "mapping(contract IERC20 => contract IStableMasterFront)", + "numberOfBytes": "32", + "value": "t_contract(IStableMasterFront)4056" + }, + "t_mapping(t_contract(IERC20)756,t_struct(Pairs)3550_storage)": { + "encoding": "mapping", + "key": "t_contract(IERC20)756", + "label": "mapping(contract IERC20 => struct Pairs)", + "numberOfBytes": "32", + "value": "t_struct(Pairs)3550_storage" + }, + "t_mapping(t_contract(IStableMasterFront)4056,t_mapping(t_contract(IERC20)756,t_struct(Pairs)3550_storage))": { + "encoding": "mapping", + "key": "t_contract(IStableMasterFront)4056", + "label": "mapping(contract IStableMasterFront => mapping(contract IERC20 => struct Pairs))", + "numberOfBytes": "32", + "value": "t_mapping(t_contract(IERC20)756,t_struct(Pairs)3550_storage)" + }, + "t_struct(Pairs)3550_storage": { + "encoding": "inplace", + "label": "struct Pairs", + "members": [ + { + "astId": 3540, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "poolManager", + "offset": 0, + "slot": "0", + "type": "t_contract(IPoolManager)3915" + }, + { + "astId": 3543, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "perpetualManager", + "offset": 0, + "slot": "1", + "type": "t_contract(IPerpetualManagerFrontWithClaim)3907" + }, + { + "astId": 3546, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "sanToken", + "offset": 0, + "slot": "2", + "type": "t_contract(ISanToken)3921" + }, + { + "astId": 3549, + "contract": "contracts/implementations/mainnet/AngleRouterMainnet.sol:AngleRouterMainnet", + "label": "gauge", + "offset": 0, + "slot": "3", + "type": "t_contract(ILiquidityGauge)3876" + } + ], + "numberOfBytes": "128" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/mainnet/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json b/deployments/mainnet/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json new file mode 100644 index 0000000..c75418b --- /dev/null +++ b/deployments/mainnet/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json @@ -0,0 +1,142 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\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 IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\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 require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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 */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\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. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/BaseRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport \"./interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./interfaces/external/IWETH9.sol\";\nimport \"./interfaces/ICoreBorrow.sol\";\nimport \"./interfaces/IDepositWithReferral.sol\";\nimport \"./interfaces/ILiquidityGauge.sol\";\nimport \"./interfaces/ISwapper.sol\";\nimport \"./interfaces/IVaultManager.sol\";\n\n// ============================== STRUCTS AND ENUM =============================\n\n/// @notice Action types\nenum ActionType {\n transfer,\n wrapNative,\n unwrapNative,\n sweep,\n sweepNative,\n // Deprecated\n uniswapV3,\n oneInch,\n claimRewards,\n // Deprecated\n gaugeDeposit,\n borrower,\n swapper,\n mint4626,\n deposit4626,\n redeem4626,\n withdraw4626,\n // Deprecated\n prepareRedeemSavingsRate,\n // Deprecated\n claimRedeemSavingsRate,\n // Deprecated\n swapIn,\n // Deprecated\n swapOut,\n claimWeeklyInterest,\n // Deprecated\n withdraw,\n // Deprecated\n mint,\n // Deprecated\n deposit,\n // Deprecated\n openPerpetual,\n // Deprecated\n addToPerpetual,\n veANGLEDeposit,\n // Deprecated\n claimRewardsWithPerps,\n deposit4626Referral\n}\n\n/// @notice Data needed to get permits\nstruct PermitType {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @notice Data to grant permit to the router for a vault\nstruct PermitVaultManagerType {\n address vaultManager;\n address owner;\n bool approved;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @title BaseRouter\n/// @author Angle Core Team\n/// @notice Base contract that Angle router contracts on different chains should override\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\n using SafeERC20 for IERC20;\n\n // ================================= REFERENCES ================================\n\n /// @notice Core address handling access control\n ICoreBorrow public core;\n /// @notice Address of the router used for swaps\n IUniswapV3Router public uniswapV3Router;\n /// @notice Address of 1Inch router used for swaps\n address public oneInch;\n\n uint256[47] private __gap;\n\n // ============================== EVENTS / ERRORS ==============================\n\n error IncompatibleLengths();\n error InvalidReturnMessage();\n error NotApprovedOrOwner();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error TooSmallAmountOut();\n error TransferFailed();\n error ZeroAddress();\n\n event ReferredDeposit(\n address caller,\n address indexed owner,\n uint256 assets,\n uint256 shares,\n address indexed savings,\n address indexed referrer\n );\n\n /// @notice Deploys the router contract on a chain\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\n if (_core == address(0)) revert ZeroAddress();\n core = ICoreBorrow(_core);\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\n oneInch = _oneInch;\n }\n\n constructor() initializer {}\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @notice Allows composable calls to different functions within the protocol\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\n /// @param actions List of actions to be performed by the router (in order of execution)\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\n /// for a given action are stored\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\n /// do not perform a sweep action on these tokens\n function mixer(\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) public payable virtual {\n // If all tokens have already been approved, there's no need for this step\n uint256 permitsLength = paramsPermit.length;\n for (uint256 i; i < permitsLength; ++i) {\n IERC20Permit(paramsPermit[i].token).permit(\n paramsPermit[i].owner,\n address(this),\n paramsPermit[i].value,\n paramsPermit[i].deadline,\n paramsPermit[i].v,\n paramsPermit[i].r,\n paramsPermit[i].s\n );\n }\n // Performing actions one after the others\n uint256 actionsLength = actions.length;\n for (uint256 i; i < actionsLength; ++i) {\n if (actions[i] == ActionType.transfer) {\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\n } else if (actions[i] == ActionType.wrapNative) {\n _wrapNative();\n } else if (actions[i] == ActionType.unwrapNative) {\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\n _unwrapNative(minAmountOut, to);\n } else if (actions[i] == ActionType.sweep) {\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\n _sweep(tokenOut, minAmountOut, to);\n } else if (actions[i] == ActionType.sweepNative) {\n uint256 routerBalance = address(this).balance;\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\n } else if (actions[i] == ActionType.oneInch) {\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\n data[i],\n (address, uint256, bytes)\n );\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\n } else if (actions[i] == ActionType.claimRewards) {\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\n _claimRewards(user, claimLiquidityGauges);\n } else if (actions[i] == ActionType.borrower) {\n (\n address collateral,\n address vaultManager,\n address to,\n address who,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n bytes memory repayData\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\n } else if (actions[i] == ActionType.swapper) {\n (\n ISwapper swapperContract,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory payload\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\n } else if (actions[i] == ActionType.mint4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _mint4626(savingsRate, shares, to, maxAmountIn);\n } else if (actions[i] == ActionType.deposit4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626(savingsRate, amount, to, minSharesOut);\n } else if (actions[i] == ActionType.deposit4626Referral) {\n (\n IERC20 token,\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\n } else if (actions[i] == ActionType.redeem4626) {\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _redeem4626(savingsRate, shares, to, minAmountOut);\n } else if (actions[i] == ActionType.withdraw4626) {\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\n } else {\n _chainSpecificAction(actions[i], data[i]);\n }\n }\n }\n\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\n /// addresses depositing from a certain referring address into an ERC4626 contract\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n _changeAllowance(IERC20(token), savings, type(uint256).max);\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\n }\n\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\n /// actions and then revoking this approval after these actions\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\n /// to revoke approvals\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\n /// is just an option\n function mixerVaultManagerPermit(\n PermitVaultManagerType[] memory paramsPermitVaultManager,\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) external payable virtual {\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n true,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n } else break;\n }\n mixer(paramsPermit, actions, data);\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\n // too deep\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (!paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n false,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n }\n }\n }\n\n receive() external payable {}\n\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\n\n /// @notice Wraps the native token of a chain to its wrapped version\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\n /// @dev The amount to wrap is to be specified in the `msg.value`\n function _wrapNative() internal virtual returns (uint256) {\n _getNativeWrapper().deposit{ value: msg.value }();\n return msg.value;\n }\n\n /// @notice Unwraps the wrapped version of a token to the native chain token\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\n amount = _getNativeWrapper().balanceOf(address(this));\n _slippageCheck(amount, minAmountOut);\n if (amount != 0) {\n _getNativeWrapper().withdraw(amount);\n _safeTransferNative(to, amount);\n }\n return amount;\n }\n\n /// @notice Internal version of the `claimRewards` function\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\n uint256 gaugesLength = liquidityGauges.length;\n for (uint256 i; i < gaugesLength; ++i) {\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\n }\n }\n\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\n /// @param vaultManager Address of the vault to perform actions on\n /// @param actionsBorrow Actions type to perform on the vaultManager\n /// @param dataBorrow Data needed for each actions\n /// @param to Address to send the funds to\n /// @param who Swapper address to handle repayments\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\n function _angleBorrower(\n address vaultManager,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address to,\n address who,\n bytes memory repayData\n ) internal virtual returns (PaymentData memory paymentData) {\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\n }\n\n /// @notice Sweeps tokens from the router contract\n /// @param tokenOut Token to sweep\n /// @param minAmountOut Minimum amount of tokens to recover\n /// @param to Address to which tokens should be sent\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\n _slippageCheck(balanceToken, minAmountOut);\n if (balanceToken != 0) {\n IERC20(tokenOut).safeTransfer(to, balanceToken);\n }\n }\n\n /// @notice Uses an external swapper\n /// @param swapper Contracts implementing the logic of the swap\n /// @param inToken Token used to do the swap\n /// @param outToken Token wanted\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\n /// @param inTokenObtained Amount of `inToken` used for the swap\n /// @param data Additional info for the specific swapper\n function _swapper(\n ISwapper swapper,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) internal {\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\n }\n\n /// @notice Swaps an inToken to another token via 1Inch Router\n /// @param payload Bytes needed for 1Inch router to process the swap\n /// @dev The `payload` given is expected to be obtained from 1Inch API\n function _swapOn1Inch(\n IERC20 inToken,\n uint256 minAmountOut,\n bytes memory payload\n ) internal returns (uint256 amountOut) {\n // Approve transfer to the `oneInch` address\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\n address oneInchRouter = oneInch;\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\n //solhint-disable-next-line\n (bool success, bytes memory result) = oneInchRouter.call(payload);\n if (!success) _revertBytes(result);\n\n amountOut = abi.decode(result, (uint256));\n _slippageCheck(amountOut, minAmountOut);\n }\n\n /// @notice Mints `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to mint shares from\n /// @param shares Amount of shares to mint from the contract\n /// @param to Address to which shares should be sent\n /// @param maxAmountIn Max amount of assets used to mint\n /// @return amountIn Amount of assets used to mint by `to`\n function _mint4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 maxAmountIn\n ) internal returns (uint256 amountIn) {\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\n }\n\n /// @notice Deposits `amount` to an ERC4626 contract\n /// @param savingsRate The ERC4626 to deposit assets to\n /// @param amount Amount of assets to deposit\n /// @param to Address to which shares should be sent\n /// @param minSharesOut Minimum amount of shares that `to` should received\n /// @return sharesOut Amount of shares received by `to`\n function _deposit4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\n }\n\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\n function _deposit4626Referral(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) internal returns (uint256 sharesOut) {\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\n }\n\n /// @notice Withdraws `amount` from an ERC4626 contract\n /// @param savingsRate ERC4626 to withdraw assets from\n /// @param amount Amount of assets to withdraw\n /// @param to Destination of assets\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\n /// @return sharesOut Amount of shares burnt\n function _withdraw4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 maxSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\n }\n\n /// @notice Redeems `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to redeem shares from\n /// @param shares Amount of shares to redeem\n /// @param to Destination of assets\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\n /// @return amountOut Amount of assets received by `to`\n function _redeem4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 minAmountOut\n ) internal returns (uint256 amountOut) {\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\n }\n\n /// @notice Allows to perform some specific actions for a chain\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\n\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\n\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\n\n // ============================ GOVERNANCE FUNCTION ============================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Sets a new `core` contract\n function setCore(ICoreBorrow _core) external {\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\n core = ICoreBorrow(_core);\n }\n\n /// @notice Changes allowances for different tokens\n /// @param tokens Addresses of the tokens to allow\n /// @param spenders Addresses to allow transfer\n /// @param amounts Amounts to allow\n function changeAllowance(\n IERC20[] calldata tokens,\n address[] calldata spenders,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\n for (uint256 i; i < tokensLength; ++i) {\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\n }\n }\n\n /// @notice Sets a new router variable\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\n if (router == address(0)) revert ZeroAddress();\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\n else oneInch = router;\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Changes allowance of this contract for a given token\n /// @param token Address of the token to change allowance\n /// @param spender Address to change the allowance of\n /// @param amount Amount allowed\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\n uint256 currentAllowance = token.allowance(address(this), spender);\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\n } else if (currentAllowance > amount) {\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\n }\n }\n\n /// @notice Transfer amount of the native token to the `to` address\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\n function _safeTransferNative(address to, uint256 amount) internal {\n bool success;\n //solhint-disable-next-line\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) revert TransferFailed();\n }\n\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\n /// the calling address is well approved for all the vaults with which it is interacting\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\n /// with a vault are approved for this vault\n function _parseVaultIDs(\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address vaultManager,\n address collateral\n ) internal view returns (bytes[] memory) {\n uint256 actionsBorrowLength = actionsBorrow.length;\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\n bool createVaultAction;\n uint256 lastVaultID;\n uint256 vaultIDLength;\n for (uint256 i; i < actionsBorrowLength; ++i) {\n uint256 vaultID;\n // If there is a `createVault` action, the router should not worry about looking at\n // next vaultIDs given equal to 0\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\n createVaultAction = true;\n continue;\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\n // as collateral the full contract balance\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\n uint256 amount;\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\n if (amount == type(uint256).max)\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\n continue;\n // There are different ways depending on the action to find the `vaultID` to parse\n } else if (\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\n ) {\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\n vaultID = abi.decode(dataBorrow[i], (uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\n } else continue;\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\n // if there has not been any specific action\n if (vaultID == 0) {\n if (createVaultAction) {\n continue;\n } else {\n // If we haven't stored the last `vaultID`, we need to fetch it\n if (lastVaultID == 0) {\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\n }\n vaultID = lastVaultID;\n }\n }\n\n // Check if this `vaultID` has already been verified\n for (uint256 j; j < vaultIDLength; ++j) {\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\n // If yes, we continue to the next iteration\n continue;\n }\n }\n // Verify this new `vaultID` and add it to the list\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\n revert NotApprovedOrOwner();\n }\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\n vaultIDLength += 1;\n }\n return dataBorrow;\n }\n\n /// @notice Checks whether the amount obtained during a swap is not too small\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\n if (amount < thresholdAmount) revert TooSmallAmountOut();\n }\n\n /// @notice Internal function used for error handling\n function _revertBytes(bytes memory errMsg) internal pure {\n if (errMsg.length != 0) {\n //solhint-disable-next-line\n assembly {\n revert(add(32, errMsg), mload(errMsg))\n }\n }\n revert InvalidReturnMessage();\n }\n}\n" + }, + "contracts/implementations/arbitrum/AngleRouterArbitrum.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterArbitrum\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\ncontract AngleRouterArbitrum is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n }\n}\n" + }, + "contracts/implementations/avalanche/AngleRouterAvalanche.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterAvalanche\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Avalanche\ncontract AngleRouterAvalanche is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n }\n}\n" + }, + "contracts/implementations/base/AngleRouterBase.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterBase\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Base\ncontract AngleRouterBase is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/celo/AngleRouterCelo.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterCelo\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Celo\ncontract AngleRouterCelo is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0000000000000000000000000000000000000000);\n }\n}\n" + }, + "contracts/implementations/gnosis/AngleRouterGnosis.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterGnosis\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Gnosis\ncontract AngleRouterGnosis is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n }\n}\n" + }, + "contracts/implementations/mainnet/AngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../interfaces/IFeeDistributorFront.sol\";\nimport \"../../interfaces/ISanToken.sol\";\nimport \"../../interfaces/IStableMasterFront.sol\";\nimport \"../../interfaces/IVeANGLE.sol\";\n\nimport \"../../BaseRouter.sol\";\n\n// ============================= STRUCTS AND ENUMS =============================\n\n/// @notice References to the contracts associated to a collateral for a stablecoin\nstruct Pairs {\n IPoolManager poolManager;\n IPerpetualManagerFrontWithClaim perpetualManager;\n ISanToken sanToken;\n ILiquidityGauge gauge;\n}\n\n/// @title AngleRouterMainnet\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Ethereum\n/// @dev Previous implementation with an initialization function can be found here:\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\ncontract AngleRouterMainnet is BaseRouter {\n using SafeERC20 for IERC20;\n\n // =================================== ERRORS ==================================\n\n error InvalidParams();\n\n // ================================== MAPPINGS =================================\n\n /// @notice Maps an agToken to its counterpart `StableMaster`\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\n\n uint256[48] private __gapMainnet;\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @inheritdoc BaseRouter\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\n if (action == ActionType.claimWeeklyInterest) {\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\n } else if (action == ActionType.veANGLEDeposit) {\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\n _depositOnLocker(user, amount);\n }\n }\n\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n }\n\n /// @notice Deposits ANGLE on an existing locker\n /// @param user Address to deposit for\n /// @param amount Amount to deposit\n function _depositOnLocker(address user, uint256 amount) internal {\n _getVeANGLE().deposit_for(user, amount);\n }\n\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\n /// @param user Address to claim for\n /// @param _feeDistributor Address of the fee distributor to claim to\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\n /// transfer the token claimed from the `feeDistributor`\n function _claimWeeklyInterest(\n address user,\n IFeeDistributorFront _feeDistributor,\n bool letInContract\n ) internal {\n uint256 amount = _feeDistributor.claim(user);\n if (letInContract) {\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\n IERC20 token = IERC20(_feeDistributor.token());\n token.safeTransferFrom(msg.sender, address(this), amount);\n }\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Returns the veANGLE address\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\n }\n}\n" + }, + "contracts/implementations/optimism/AngleRouterOptimism.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterOptimism\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Optimism\ncontract AngleRouterOptimism is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/polygon/AngleRouterPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterPolygon\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Polygon\ncontract AngleRouterPolygon is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n }\n}\n" + }, + "contracts/interfaces/external/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nstruct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n}\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IUniswapV3Router {\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n\n/// @title Router for price estimation functionality\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\n/// @dev This interface is only used for non critical elements of the protocol\ninterface IUniswapV2Router {\n /// @notice Given an input asset amount, returns the maximum output amount of the\n /// other asset (accounting for fees) given reserves.\n /// @param path Addresses of the pools used to get prices\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokens(\n uint256 swapAmount,\n uint256 minExpected,\n address[] calldata path,\n address receiver,\n uint256 swapDeadline\n ) external;\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICoreBorrow\n/// @author Angle Core Team\n/// @notice Interface for the `CoreBorrow` contract\n\ninterface ICoreBorrow {\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IDepositWithReferral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title IDepositWithReferral\n/// @author Angle Core Team\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\ninterface IDepositWithReferral {\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\n /// obtained, the function reverts\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\n /// when a deposit takes place\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut);\n}\n" + }, + "contracts/interfaces/IFeeDistributorFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IFeeDistributorFront\n/// @author Interface for public use of the `FeeDistributor` contract\n/// @dev This interface is used for user related function\ninterface IFeeDistributorFront {\n function token() external returns (address);\n\n function claim(address _addr) external returns (uint256);\n\n function claim(address[20] memory _addr) external returns (bool);\n}\n" + }, + "contracts/interfaces/ILiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function staking_token() external returns (address stakingToken);\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external;\n}\n" + }, + "contracts/interfaces/IPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title Interface of the contract managing perpetuals with claim function\n/// @author Angle Core Team\n/// @dev Front interface with rewards function, meaning only user-facing functions\ninterface IPerpetualManagerFrontWithClaim {\n function getReward(uint256 perpetualID) external;\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\n\n function openPerpetual(\n address owner,\n uint256 amountBrought,\n uint256 amountCommitted,\n uint256 maxOracleRate,\n uint256 minNetMargin\n ) external returns (uint256 perpetualID);\n}\n" + }, + "contracts/interfaces/IPoolManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IPoolManager {\n function token() external view returns (address);\n}\n" + }, + "contracts/interfaces/ISanToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ISanToken is IERC20Upgradeable {}\n" + }, + "contracts/interfaces/IStableMasterFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IPoolManager.sol\";\nimport \"./ISanToken.sol\";\nimport \"./IPerpetualManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Struct to handle all the parameters to manage the fees\n// related to a given collateral pool (associated to the stablecoin)\nstruct MintBurnData {\n // Values of the thresholds to compute the minting fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeMint;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeMint;\n // Values of the thresholds to compute the burning fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeBurn;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeBurn;\n // Max proportion of collateral from users that can be covered by HAs\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\n // the other changes accordingly\n uint64 targetHAHedge;\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusMint;\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusBurn;\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\n uint256 capOnStableMinted;\n}\n\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\n// including the fraction of interests they receive or the fees to be distributed to\n// them\nstruct SLPData {\n // Last timestamp at which the `sanRate` has been updated for SLPs\n uint256 lastBlockUpdated;\n // Fees accumulated from previous blocks and to be distributed to SLPs\n uint256 lockedInterests;\n // Max interests used to update the `sanRate` in a single block\n // Should be in collateral token base\n uint256 maxInterestsDistributed;\n // Amount of fees left aside for SLPs and that will be distributed\n // when the protocol is collateralized back again\n uint256 feesAside;\n // Part of the fees normally going to SLPs that is left aside\n // before the protocol is collateralized back again (depends on collateral ratio)\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippageFee;\n // Portion of the fees from users minting and burning\n // that goes to SLPs (the rest goes to surplus)\n uint64 feesForSLPs;\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippage;\n // Portion of the interests from lending\n // that goes to SLPs (the rest goes to surplus)\n uint64 interestsForSLPs;\n}\n\n/// @title IStableMasterFront\n/// @author Angle Core Team\n/// @dev Front interface, meaning only user-facing functions\ninterface IStableMasterFront {\n function collateralMap(IPoolManager poolManager)\n external\n view\n returns (\n IERC20 token,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n address oracle,\n uint256 stocksUsers,\n uint256 sanRate,\n uint256 collatBase,\n SLPData memory slpData,\n MintBurnData memory feeData\n );\n\n function updateStocksUsers(uint256 amount, address poolManager) external;\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256 minStableAmount\n ) external;\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256 minCollatAmount\n ) external;\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external;\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external;\n\n function agToken() external returns (address);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Core Team\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\ninterface ISwapper {\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager``\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\n uint256 normalizedDebt;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionBorrowType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IVeANGLE\n/// @author Angle Core Team\n/// @notice Interface for the `VeANGLE` contract\ninterface IVeANGLE {\n // solhint-disable-next-line func-name-mixedcase\n function deposit_for(address addr, uint256 amount) external;\n}\n" + }, + "contracts/mock/MockAngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../implementations/mainnet/AngleRouterMainnet.sol\";\n\ncontract MockAngleRouterMainnet is AngleRouterMainnet {\n address public veAngle;\n\n function setAngleAndVeANGLE(address _veAngle) external {\n veAngle = _veAngle;\n }\n\n function _getVeANGLE() internal view override returns (IVeANGLE) {\n return IVeANGLE(veAngle);\n }\n\n function addStableMaster(IERC20 stablecoin, IStableMasterFront stableMaster) external {\n mapStableMasters[stablecoin] = stableMaster;\n }\n\n function addPairs(\n IERC20[] calldata stablecoins,\n IPoolManager[] calldata poolManagers,\n ILiquidityGauge[] calldata liquidityGauges,\n bool[] calldata justLiquidityGauges\n ) external {\n for (uint256 i; i < stablecoins.length; ++i) {\n IStableMasterFront stableMaster = mapStableMasters[stablecoins[i]];\n _addPair(stableMaster, poolManagers[i], liquidityGauges[i], justLiquidityGauges[i]);\n }\n }\n\n function _addPair(\n IStableMasterFront stableMaster,\n IPoolManager poolManager,\n ILiquidityGauge liquidityGauge,\n bool justLiquidityGauge\n ) internal {\n // Fetching the associated `sanToken` and `perpetualManager` from the contract\n (\n IERC20 collateral,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n ,\n ,\n ,\n ,\n ,\n\n ) = stableMaster.collateralMap(poolManager);\n // Reverting if the poolManager is not a valid `poolManager`\n if (address(collateral) == address(0)) revert InvalidParams();\n Pairs storage _pairs = mapPoolManagers[stableMaster][collateral];\n if (justLiquidityGauge) {\n // Cannot specify a liquidity gauge if the associated poolManager does not exist\n if (address(_pairs.poolManager) == address(0)) revert ZeroAddress();\n ILiquidityGauge gauge = _pairs.gauge;\n if (address(gauge) != address(0)) {\n _changeAllowance(IERC20(address(sanToken)), address(gauge), 0);\n }\n } else {\n // Checking if the pair has not already been initialized: if yes we need to make the function revert\n // otherwise we could end up with still approved `PoolManager` and `PerpetualManager` contracts\n if (address(_pairs.poolManager) != address(0)) revert InvalidParams();\n _pairs.poolManager = poolManager;\n _pairs.perpetualManager = IPerpetualManagerFrontWithClaim(address(perpetualManager));\n _pairs.sanToken = sanToken;\n _changeAllowance(collateral, address(stableMaster), type(uint256).max);\n _changeAllowance(collateral, address(perpetualManager), type(uint256).max);\n }\n _pairs.gauge = liquidityGauge;\n if (address(liquidityGauge) != address(0)) {\n if (address(sanToken) != liquidityGauge.staking_token()) revert InvalidParams();\n _changeAllowance(IERC20(address(sanToken)), address(liquidityGauge), type(uint256).max);\n }\n }\n}\n\ncontract MockAngleRouterMainnet2 is AngleRouterMainnet {\n function getVeANGLE() external view returns (IVeANGLE) {\n return _getVeANGLE();\n }\n}\n" + }, + "contracts/mock/MockRouterSidechain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/external/IWETH9.sol\";\n\nimport \"../BaseRouter.sol\";\n\n/// @title MockRouterSidechain\n/// @author Angle Core Team\n/// @notice Mock contract but built for tests as if to be deployed on Ethereum\ncontract MockRouterSidechain is BaseRouter {\n IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function _wrapNative() internal pure override returns (uint256) {\n return 0;\n }\n\n function _unwrapNative(uint256, address) internal pure override returns (uint256 amount) {\n return 0;\n }\n\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return WETH;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/optimism/AngleRouterOptimismV3_0_Implementation.json b/deployments/optimism/AngleRouterOptimismV3_0_Implementation.json new file mode 100644 index 0000000..fd6cf1d --- /dev/null +++ b/deployments/optimism/AngleRouterOptimismV3_0_Implementation.json @@ -0,0 +1,618 @@ +{ + "address": "0xDAcf64fe735F5333474C9aE8000120002327a55A", + "abi": [ + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReturnMessage", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferredDeposit", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "spenders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "changeAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit4626Referral", + "outputs": [ + { + "internalType": "uint256", + "name": "sharesOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_uniswapRouter", + "type": "address" + }, + { + "internalType": "address", + "name": "_oneInch", + "type": "address" + } + ], + "name": "initializeRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vaultManager", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitVaultManagerType[]", + "name": "paramsPermitVaultManager", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixerVaultManagerPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "oneInch", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "_core", + "type": "address" + } + ], + "name": "setCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "internalType": "uint8", + "name": "who", + "type": "uint8" + } + ], + "name": "setRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "uniswapV3Router", + "outputs": [ + { + "internalType": "contract IUniswapV3Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xbb67308a1103ea6e52d6e75f89e8a1a53a71fe2f328dfb9bf3f032237b66f6c9", + "receipt": { + "to": null, + "from": "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701", + "contractAddress": "0xDAcf64fe735F5333474C9aE8000120002327a55A", + "transactionIndex": 14, + "gasUsed": "3564242", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000400000000000000000040000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000", + "blockHash": "0xff71ca26440952748608ee8f7b52fac079f7bb30c95c39e7e5bb0db95337f820", + "transactionHash": "0xbb67308a1103ea6e52d6e75f89e8a1a53a71fe2f328dfb9bf3f032237b66f6c9", + "logs": [ + { + "transactionIndex": 14, + "blockNumber": 119995215, + "transactionHash": "0xbb67308a1103ea6e52d6e75f89e8a1a53a71fe2f328dfb9bf3f032237b66f6c9", + "address": "0xDAcf64fe735F5333474C9aE8000120002327a55A", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 16, + "blockHash": "0xff71ca26440952748608ee8f7b52fac079f7bb30c95c39e7e5bb0db95337f820" + } + ], + "blockNumber": 119995215, + "cumulativeGasUsed": "4270939", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0d1b1c94fd2e1964436c8b9a0e25c545", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReturnMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApprovedOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferredDeposit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"spenders\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"changeAllowance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minSharesOut\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"deposit4626Referral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sharesOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_uniswapRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oneInch\",\"type\":\"address\"}],\"name\":\"initializeRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"vaultManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitVaultManagerType[]\",\"name\":\"paramsPermitVaultManager\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixerVaultManagerPermit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oneInch\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"setCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"who\",\"type\":\"uint8\"}],\"name\":\"setRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV3Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Router\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"params\":{\"amounts\":\"Amounts to allow\",\"spenders\":\"Addresses to allow transfer\",\"tokens\":\"Addresses of the tokens to allow\"}},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens\",\"params\":{\"actions\":\"List of actions to be performed by the router (in order of execution)\",\"data\":\"Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored\",\"paramsPermit\":\"Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\"}},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option\",\"params\":{\"paramsPermitVaultManager\":\"Parameters to sign permit to give allowance to the router for a `VaultManager` contract\"}}},\"title\":\"AngleRouterOptimism\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"notice\":\"Changes allowances for different tokens\"},\"core()\":{\"notice\":\"Core address handling access control\"},\"deposit4626Referral(address,address,uint256,address,uint256,address)\":{\"notice\":\"Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract\"},\"initializeRouter(address,address,address)\":{\"notice\":\"Deploys the router contract on a chain\"},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Allows composable calls to different functions within the protocol\"},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions\"},\"oneInch()\":{\"notice\":\"Address of 1Inch router used for swaps\"},\"setCore(address)\":{\"notice\":\"Sets a new `core` contract\"},\"setRouter(address,uint8)\":{\"notice\":\"Sets a new router variable\"},\"uniswapV3Router()\":{\"notice\":\"Address of the router used for swaps\"}},\"notice\":\"Router contract built specifially for Angle use cases on Optimism\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/implementations/optimism/AngleRouterOptimism.sol\":\"AngleRouterOptimism\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x9750c6fec736eb3320e85924f36a3060fa4a4ab1758d06d9585e175d164eefdb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\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 IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\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 require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\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 */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\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. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"contracts/BaseRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport \\\"./interfaces/external/uniswap/IUniswapRouter.sol\\\";\\nimport \\\"./interfaces/external/IWETH9.sol\\\";\\nimport \\\"./interfaces/ICoreBorrow.sol\\\";\\nimport \\\"./interfaces/IDepositWithReferral.sol\\\";\\nimport \\\"./interfaces/ILiquidityGauge.sol\\\";\\nimport \\\"./interfaces/ISwapper.sol\\\";\\nimport \\\"./interfaces/IVaultManager.sol\\\";\\n\\n// ============================== STRUCTS AND ENUM =============================\\n\\n/// @notice Action types\\nenum ActionType {\\n transfer,\\n wrapNative,\\n unwrapNative,\\n sweep,\\n sweepNative,\\n // Deprecated\\n uniswapV3,\\n oneInch,\\n claimRewards,\\n // Deprecated\\n gaugeDeposit,\\n borrower,\\n swapper,\\n mint4626,\\n deposit4626,\\n redeem4626,\\n withdraw4626,\\n // Deprecated\\n prepareRedeemSavingsRate,\\n // Deprecated\\n claimRedeemSavingsRate,\\n // Deprecated\\n swapIn,\\n // Deprecated\\n swapOut,\\n claimWeeklyInterest,\\n // Deprecated\\n withdraw,\\n // Deprecated\\n mint,\\n // Deprecated\\n deposit,\\n // Deprecated\\n openPerpetual,\\n // Deprecated\\n addToPerpetual,\\n veANGLEDeposit,\\n // Deprecated\\n claimRewardsWithPerps,\\n deposit4626Referral\\n}\\n\\n/// @notice Data needed to get permits\\nstruct PermitType {\\n address token;\\n address owner;\\n uint256 value;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @notice Data to grant permit to the router for a vault\\nstruct PermitVaultManagerType {\\n address vaultManager;\\n address owner;\\n bool approved;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @title BaseRouter\\n/// @author Angle Core Team\\n/// @notice Base contract that Angle router contracts on different chains should override\\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\\n using SafeERC20 for IERC20;\\n\\n // ================================= REFERENCES ================================\\n\\n /// @notice Core address handling access control\\n ICoreBorrow public core;\\n /// @notice Address of the router used for swaps\\n IUniswapV3Router public uniswapV3Router;\\n /// @notice Address of 1Inch router used for swaps\\n address public oneInch;\\n\\n uint256[47] private __gap;\\n\\n // ============================== EVENTS / ERRORS ==============================\\n\\n error IncompatibleLengths();\\n error InvalidReturnMessage();\\n error NotApprovedOrOwner();\\n error NotGovernor();\\n error NotGovernorOrGuardian();\\n error TooSmallAmountOut();\\n error TransferFailed();\\n error ZeroAddress();\\n\\n event ReferredDeposit(\\n address caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares,\\n address indexed savings,\\n address indexed referrer\\n );\\n\\n /// @notice Deploys the router contract on a chain\\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\\n if (_core == address(0)) revert ZeroAddress();\\n core = ICoreBorrow(_core);\\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\\n oneInch = _oneInch;\\n }\\n\\n constructor() initializer {}\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @notice Allows composable calls to different functions within the protocol\\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\\n /// @param actions List of actions to be performed by the router (in order of execution)\\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\\n /// for a given action are stored\\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\\n /// do not perform a sweep action on these tokens\\n function mixer(\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) public payable virtual {\\n // If all tokens have already been approved, there's no need for this step\\n uint256 permitsLength = paramsPermit.length;\\n for (uint256 i; i < permitsLength; ++i) {\\n IERC20Permit(paramsPermit[i].token).permit(\\n paramsPermit[i].owner,\\n address(this),\\n paramsPermit[i].value,\\n paramsPermit[i].deadline,\\n paramsPermit[i].v,\\n paramsPermit[i].r,\\n paramsPermit[i].s\\n );\\n }\\n // Performing actions one after the others\\n uint256 actionsLength = actions.length;\\n for (uint256 i; i < actionsLength; ++i) {\\n if (actions[i] == ActionType.transfer) {\\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\\n } else if (actions[i] == ActionType.wrapNative) {\\n _wrapNative();\\n } else if (actions[i] == ActionType.unwrapNative) {\\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\\n _unwrapNative(minAmountOut, to);\\n } else if (actions[i] == ActionType.sweep) {\\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\\n _sweep(tokenOut, minAmountOut, to);\\n } else if (actions[i] == ActionType.sweepNative) {\\n uint256 routerBalance = address(this).balance;\\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\\n } else if (actions[i] == ActionType.oneInch) {\\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\\n data[i],\\n (address, uint256, bytes)\\n );\\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\\n } else if (actions[i] == ActionType.claimRewards) {\\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\\n _claimRewards(user, claimLiquidityGauges);\\n } else if (actions[i] == ActionType.borrower) {\\n (\\n address collateral,\\n address vaultManager,\\n address to,\\n address who,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n bytes memory repayData\\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\\n } else if (actions[i] == ActionType.swapper) {\\n (\\n ISwapper swapperContract,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory payload\\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\\n } else if (actions[i] == ActionType.mint4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _mint4626(savingsRate, shares, to, maxAmountIn);\\n } else if (actions[i] == ActionType.deposit4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626(savingsRate, amount, to, minSharesOut);\\n } else if (actions[i] == ActionType.deposit4626Referral) {\\n (\\n IERC20 token,\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\\n } else if (actions[i] == ActionType.redeem4626) {\\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _redeem4626(savingsRate, shares, to, minAmountOut);\\n } else if (actions[i] == ActionType.withdraw4626) {\\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\\n } else {\\n _chainSpecificAction(actions[i], data[i]);\\n }\\n }\\n }\\n\\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\\n /// addresses depositing from a certain referring address into an ERC4626 contract\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut) {\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n _changeAllowance(IERC20(token), savings, type(uint256).max);\\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\\n }\\n\\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\\n /// actions and then revoking this approval after these actions\\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\\n /// to revoke approvals\\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\\n /// is just an option\\n function mixerVaultManagerPermit(\\n PermitVaultManagerType[] memory paramsPermitVaultManager,\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) external payable virtual {\\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n true,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n } else break;\\n }\\n mixer(paramsPermit, actions, data);\\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\\n // too deep\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (!paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n false,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n }\\n }\\n }\\n\\n receive() external payable {}\\n\\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\\n\\n /// @notice Wraps the native token of a chain to its wrapped version\\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\\n /// @dev The amount to wrap is to be specified in the `msg.value`\\n function _wrapNative() internal virtual returns (uint256) {\\n _getNativeWrapper().deposit{ value: msg.value }();\\n return msg.value;\\n }\\n\\n /// @notice Unwraps the wrapped version of a token to the native chain token\\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\\n amount = _getNativeWrapper().balanceOf(address(this));\\n _slippageCheck(amount, minAmountOut);\\n if (amount != 0) {\\n _getNativeWrapper().withdraw(amount);\\n _safeTransferNative(to, amount);\\n }\\n return amount;\\n }\\n\\n /// @notice Internal version of the `claimRewards` function\\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\\n uint256 gaugesLength = liquidityGauges.length;\\n for (uint256 i; i < gaugesLength; ++i) {\\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\\n }\\n }\\n\\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\\n /// @param vaultManager Address of the vault to perform actions on\\n /// @param actionsBorrow Actions type to perform on the vaultManager\\n /// @param dataBorrow Data needed for each actions\\n /// @param to Address to send the funds to\\n /// @param who Swapper address to handle repayments\\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\\n function _angleBorrower(\\n address vaultManager,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address to,\\n address who,\\n bytes memory repayData\\n ) internal virtual returns (PaymentData memory paymentData) {\\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\\n }\\n\\n /// @notice Sweeps tokens from the router contract\\n /// @param tokenOut Token to sweep\\n /// @param minAmountOut Minimum amount of tokens to recover\\n /// @param to Address to which tokens should be sent\\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\\n _slippageCheck(balanceToken, minAmountOut);\\n if (balanceToken != 0) {\\n IERC20(tokenOut).safeTransfer(to, balanceToken);\\n }\\n }\\n\\n /// @notice Uses an external swapper\\n /// @param swapper Contracts implementing the logic of the swap\\n /// @param inToken Token used to do the swap\\n /// @param outToken Token wanted\\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\\n /// @param inTokenObtained Amount of `inToken` used for the swap\\n /// @param data Additional info for the specific swapper\\n function _swapper(\\n ISwapper swapper,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) internal {\\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\\n }\\n\\n /// @notice Swaps an inToken to another token via 1Inch Router\\n /// @param payload Bytes needed for 1Inch router to process the swap\\n /// @dev The `payload` given is expected to be obtained from 1Inch API\\n function _swapOn1Inch(\\n IERC20 inToken,\\n uint256 minAmountOut,\\n bytes memory payload\\n ) internal returns (uint256 amountOut) {\\n // Approve transfer to the `oneInch` address\\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\\n address oneInchRouter = oneInch;\\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\\n //solhint-disable-next-line\\n (bool success, bytes memory result) = oneInchRouter.call(payload);\\n if (!success) _revertBytes(result);\\n\\n amountOut = abi.decode(result, (uint256));\\n _slippageCheck(amountOut, minAmountOut);\\n }\\n\\n /// @notice Mints `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to mint shares from\\n /// @param shares Amount of shares to mint from the contract\\n /// @param to Address to which shares should be sent\\n /// @param maxAmountIn Max amount of assets used to mint\\n /// @return amountIn Amount of assets used to mint by `to`\\n function _mint4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 maxAmountIn\\n ) internal returns (uint256 amountIn) {\\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\\n }\\n\\n /// @notice Deposits `amount` to an ERC4626 contract\\n /// @param savingsRate The ERC4626 to deposit assets to\\n /// @param amount Amount of assets to deposit\\n /// @param to Address to which shares should be sent\\n /// @param minSharesOut Minimum amount of shares that `to` should received\\n /// @return sharesOut Amount of shares received by `to`\\n function _deposit4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\\n }\\n\\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\\n function _deposit4626Referral(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) internal returns (uint256 sharesOut) {\\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\\n }\\n\\n /// @notice Withdraws `amount` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to withdraw assets from\\n /// @param amount Amount of assets to withdraw\\n /// @param to Destination of assets\\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\\n /// @return sharesOut Amount of shares burnt\\n function _withdraw4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 maxSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\\n }\\n\\n /// @notice Redeems `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to redeem shares from\\n /// @param shares Amount of shares to redeem\\n /// @param to Destination of assets\\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\\n /// @return amountOut Amount of assets received by `to`\\n function _redeem4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 minAmountOut\\n ) internal returns (uint256 amountOut) {\\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\\n }\\n\\n /// @notice Allows to perform some specific actions for a chain\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\\n\\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\\n\\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\\n\\n // ============================ GOVERNANCE FUNCTION ============================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Sets a new `core` contract\\n function setCore(ICoreBorrow _core) external {\\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\\n core = ICoreBorrow(_core);\\n }\\n\\n /// @notice Changes allowances for different tokens\\n /// @param tokens Addresses of the tokens to allow\\n /// @param spenders Addresses to allow transfer\\n /// @param amounts Amounts to allow\\n function changeAllowance(\\n IERC20[] calldata tokens,\\n address[] calldata spenders,\\n uint256[] calldata amounts\\n ) external onlyGovernorOrGuardian {\\n uint256 tokensLength = tokens.length;\\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\\n for (uint256 i; i < tokensLength; ++i) {\\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\\n }\\n }\\n\\n /// @notice Sets a new router variable\\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\\n if (router == address(0)) revert ZeroAddress();\\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\\n else oneInch = router;\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Changes allowance of this contract for a given token\\n /// @param token Address of the token to change allowance\\n /// @param spender Address to change the allowance of\\n /// @param amount Amount allowed\\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\\n } else if (currentAllowance > amount) {\\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\\n }\\n }\\n\\n /// @notice Transfer amount of the native token to the `to` address\\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\\n function _safeTransferNative(address to, uint256 amount) internal {\\n bool success;\\n //solhint-disable-next-line\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n if (!success) revert TransferFailed();\\n }\\n\\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\\n /// the calling address is well approved for all the vaults with which it is interacting\\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\\n /// with a vault are approved for this vault\\n function _parseVaultIDs(\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address vaultManager,\\n address collateral\\n ) internal view returns (bytes[] memory) {\\n uint256 actionsBorrowLength = actionsBorrow.length;\\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\\n bool createVaultAction;\\n uint256 lastVaultID;\\n uint256 vaultIDLength;\\n for (uint256 i; i < actionsBorrowLength; ++i) {\\n uint256 vaultID;\\n // If there is a `createVault` action, the router should not worry about looking at\\n // next vaultIDs given equal to 0\\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\\n createVaultAction = true;\\n continue;\\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\\n // as collateral the full contract balance\\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\\n uint256 amount;\\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\\n if (amount == type(uint256).max)\\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\\n continue;\\n // There are different ways depending on the action to find the `vaultID` to parse\\n } else if (\\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\\n ) {\\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\\n vaultID = abi.decode(dataBorrow[i], (uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\\n } else continue;\\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\\n // if there has not been any specific action\\n if (vaultID == 0) {\\n if (createVaultAction) {\\n continue;\\n } else {\\n // If we haven't stored the last `vaultID`, we need to fetch it\\n if (lastVaultID == 0) {\\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\\n }\\n vaultID = lastVaultID;\\n }\\n }\\n\\n // Check if this `vaultID` has already been verified\\n for (uint256 j; j < vaultIDLength; ++j) {\\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\\n // If yes, we continue to the next iteration\\n continue;\\n }\\n }\\n // Verify this new `vaultID` and add it to the list\\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\\n revert NotApprovedOrOwner();\\n }\\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\\n vaultIDLength += 1;\\n }\\n return dataBorrow;\\n }\\n\\n /// @notice Checks whether the amount obtained during a swap is not too small\\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\\n if (amount < thresholdAmount) revert TooSmallAmountOut();\\n }\\n\\n /// @notice Internal function used for error handling\\n function _revertBytes(bytes memory errMsg) internal pure {\\n if (errMsg.length != 0) {\\n //solhint-disable-next-line\\n assembly {\\n revert(add(32, errMsg), mload(errMsg))\\n }\\n }\\n revert InvalidReturnMessage();\\n }\\n}\\n\",\"keccak256\":\"0x5b45e51240ed42ae858c34a0e7e15003885bd998d3a47da7a4fa5604b69f5c2f\",\"license\":\"GPL-3.0\"},\"contracts/implementations/optimism/AngleRouterOptimism.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"../../BaseRouter.sol\\\";\\n\\n/// @title AngleRouterOptimism\\n/// @author Angle Core Team\\n/// @notice Router contract built specifially for Angle use cases on Optimism\\ncontract AngleRouterOptimism is BaseRouter {\\n /// @inheritdoc BaseRouter\\n function _getNativeWrapper() internal pure override returns (IWETH9) {\\n return IWETH9(0x4200000000000000000000000000000000000006);\\n }\\n}\\n\",\"keccak256\":\"0x9a09532fb1fcc4ec24069c67ae6dd6dbe03fea0c791d280c1213e56e09c8fbbd\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ICoreBorrow.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICoreBorrow\\n/// @author Angle Core Team\\n/// @notice Interface for the `CoreBorrow` contract\\n\\ninterface ICoreBorrow {\\n /// @notice Checks whether an address is governor of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2414539c445977b04bc7e9adac2e5147364994dd74e5d7118b44824956de602c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDepositWithReferral.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IDepositWithReferral\\n/// @author Angle Core Team\\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\\ninterface IDepositWithReferral {\\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\\n /// obtained, the function reverts\\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\\n /// when a deposit takes place\\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut);\\n}\\n\",\"keccak256\":\"0x69b88fa9ec5111394843f54f312c3b8c1b47490c76109a97ba90e4ac5697e960\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ILiquidityGauge.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface ILiquidityGauge {\\n // solhint-disable-next-line\\n function staking_token() external returns (address stakingToken);\\n\\n // solhint-disable-next-line\\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\\n\\n function deposit(\\n uint256 _value,\\n address _addr,\\n // solhint-disable-next-line\\n bool _claim_rewards\\n ) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr, address _receiver) external;\\n}\\n\",\"keccak256\":\"0x27144c21760603a4e441bb5eecf975ad7f71331ac0ba0a83352b280ccf734756\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\n/// @title ISwapper\\n/// @author Angle Core Team\\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\\ninterface ISwapper {\\n function swap(\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0x506f50d8447c2dc662bd844779cc66a407af07a91210612b956ef47abcc15776\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITreasury.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ITreasury\\n/// @author Angle Core Team\\n/// @notice Interface for the `Treasury` contract\\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\\n/// of this module\\ninterface ITreasury {\\n /// @notice Checks whether a given address has well been initialized in this contract\\n /// as a `VaultManager``\\n /// @param _vaultManager Address to check\\n /// @return Whether the address has been initialized or not\\n function isVaultManager(address _vaultManager) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x36bd50a0ab1c46503bb64b8d5777bf3b4fd2da0e2dcfe68c8a9702eb132eb3e2\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVaultManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./ITreasury.sol\\\";\\n\\n// ========================= Key Structs and Enums =============================\\n\\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\\n/// to the caller or associated addresses\\nstruct PaymentData {\\n // Stablecoin amount the contract should give\\n uint256 stablecoinAmountToGive;\\n // Stablecoin amount owed to the contract\\n uint256 stablecoinAmountToReceive;\\n // Collateral amount the contract should give\\n uint256 collateralAmountToGive;\\n // Collateral amount owed to the contract\\n uint256 collateralAmountToReceive;\\n}\\n\\n/// @notice Data stored to track someone's loan (or equivalently called position)\\nstruct Vault {\\n // Amount of collateral deposited in the vault\\n uint256 collateralAmount;\\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\\n uint256 normalizedDebt;\\n}\\n\\n/// @notice Actions possible when composing calls to the different entry functions proposed\\nenum ActionBorrowType {\\n createVault,\\n closeVault,\\n addCollateral,\\n removeCollateral,\\n repayDebt,\\n borrow,\\n getDebtIn,\\n permit\\n}\\n\\n// ========================= Interfaces =============================\\n\\n/// @title IVaultManagerFunctions\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface only contains functions of the contract which are called by other contracts\\n/// of this module (without getters)\\ninterface IVaultManagerFunctions {\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\\n /// @param repayData Data to pass to the repayment contract in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to,\\n address who,\\n bytes memory repayData\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Checks whether a given address is approved for a vault or owns this vault\\n /// @param spender Address for which vault ownership should be checked\\n /// @param vaultID ID of the vault to check\\n /// @return Whether the `spender` address owns or is approved for `vaultID`\\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\\n\\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\\n /// @param spender Address to give approval to\\n /// @param approved Whether to give or revoke the approval\\n /// @param deadline Deadline parameter for the signature to be valid\\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\\n function permit(\\n address owner,\\n address spender,\\n bool approved,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\\n/// @title IVaultManagerStorage\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface contains getters of the contract's public variables used by other contracts\\n/// of this module\\ninterface IVaultManagerStorage {\\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\\n function treasury() external view returns (ITreasury);\\n\\n /// @notice Reference to the collateral handled by this `VaultManager`\\n function collateral() external view returns (IERC20);\\n\\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\\n function vaultIDCount() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4cf6dc5e5b494165e4d9e524dca5c65f6307e5b005a62287c5e84f1539dc81f1\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title Interface for WETH9\\ninterface IWETH9 is IERC20 {\\n /// @notice Deposit ether to get wrapped ether\\n function deposit() external payable;\\n\\n /// @notice Withdraw wrapped ether to get ether\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0xb109c1d668416c05f61d6edea2ec7a10b2f8b386fd51a59cc12f929c73d00424\",\"license\":\"GPL-2.0-or-later\"},\"contracts/interfaces/external/uniswap/IUniswapRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nstruct ExactInputParams {\\n bytes path;\\n address recipient;\\n uint256 deadline;\\n uint256 amountIn;\\n uint256 amountOutMinimum;\\n}\\n\\n/// @title Router token swapping functionality\\n/// @notice Functions for swapping tokens via Uniswap V3\\ninterface IUniswapV3Router {\\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\\n /// @return amountOut The amount of the received token\\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\\n}\\n\\n/// @title Router for price estimation functionality\\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\\n/// @dev This interface is only used for non critical elements of the protocol\\ninterface IUniswapV2Router {\\n /// @notice Given an input asset amount, returns the maximum output amount of the\\n /// other asset (accounting for fees) given reserves.\\n /// @param path Addresses of the pools used to get prices\\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\\n\\n function swapExactTokensForTokens(\\n uint256 swapAmount,\\n uint256 minExpected,\\n address[] calldata path,\\n address receiver,\\n uint256 swapDeadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x1908fcdc6ff78ad2250f6ccacc7129df464a648cb2a5f376bedbe506d058bb73\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620018d51760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b613f52806200015c6000396000f3fe6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073420000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b60007342000000000000000000000000000000000000066040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273420000000000000000000000000000000000000690632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea26469706673582212201e6595e2cfb9a27fffdffc938671e67d9f47a82f501075e681d2ac3002efd5d364736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b600073420000000000000000000000000000000000000673ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b60007342000000000000000000000000000000000000066040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d0000000000000000000000000000000000000000000000000000000081526004810182905273420000000000000000000000000000000000000690632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea26469706673582212201e6595e2cfb9a27fffdffc938671e67d9f47a82f501075e681d2ac3002efd5d364736f6c63430008110033", + "devdoc": { + "author": "Angle Core Team", + "kind": "dev", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "params": { + "amounts": "Amounts to allow", + "spenders": "Addresses to allow transfer", + "tokens": "Addresses of the tokens to allow" + } + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens", + "params": { + "actions": "List of actions to be performed by the router (in order of execution)", + "data": "Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored", + "paramsPermit": "Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it" + } + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option", + "params": { + "paramsPermitVaultManager": "Parameters to sign permit to give allowance to the router for a `VaultManager` contract" + } + } + }, + "title": "AngleRouterOptimism", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "notice": "Changes allowances for different tokens" + }, + "core()": { + "notice": "Core address handling access control" + }, + "deposit4626Referral(address,address,uint256,address,uint256,address)": { + "notice": "Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract" + }, + "initializeRouter(address,address,address)": { + "notice": "Deploys the router contract on a chain" + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Allows composable calls to different functions within the protocol" + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions" + }, + "oneInch()": { + "notice": "Address of 1Inch router used for swaps" + }, + "setCore(address)": { + "notice": "Sets a new `core` contract" + }, + "setRouter(address,uint8)": { + "notice": "Sets a new router variable" + }, + "uniswapV3Router()": { + "notice": "Address of the router used for swaps" + } + }, + "notice": "Router contract built specifially for Angle use cases on Optimism", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6, + "contract": "contracts/implementations/optimism/AngleRouterOptimism.sol:AngleRouterOptimism", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 9, + "contract": "contracts/implementations/optimism/AngleRouterOptimism.sol:AngleRouterOptimism", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 1478, + "contract": "contracts/implementations/optimism/AngleRouterOptimism.sol:AngleRouterOptimism", + "label": "core", + "offset": 2, + "slot": "0", + "type": "t_contract(ICoreBorrow)3793" + }, + { + "astId": 1482, + "contract": "contracts/implementations/optimism/AngleRouterOptimism.sol:AngleRouterOptimism", + "label": "uniswapV3Router", + "offset": 0, + "slot": "1", + "type": "t_contract(IUniswapV3Router)4262" + }, + { + "astId": 1485, + "contract": "contracts/implementations/optimism/AngleRouterOptimism.sol:AngleRouterOptimism", + "label": "oneInch", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 1489, + "contract": "contracts/implementations/optimism/AngleRouterOptimism.sol:AngleRouterOptimism", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint256)47_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ICoreBorrow)3793": { + "encoding": "inplace", + "label": "contract ICoreBorrow", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Router)4262": { + "encoding": "inplace", + "label": "contract IUniswapV3Router", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/optimism/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json b/deployments/optimism/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json new file mode 100644 index 0000000..c75418b --- /dev/null +++ b/deployments/optimism/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json @@ -0,0 +1,142 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\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 IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\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 require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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 */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\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. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/BaseRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport \"./interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./interfaces/external/IWETH9.sol\";\nimport \"./interfaces/ICoreBorrow.sol\";\nimport \"./interfaces/IDepositWithReferral.sol\";\nimport \"./interfaces/ILiquidityGauge.sol\";\nimport \"./interfaces/ISwapper.sol\";\nimport \"./interfaces/IVaultManager.sol\";\n\n// ============================== STRUCTS AND ENUM =============================\n\n/// @notice Action types\nenum ActionType {\n transfer,\n wrapNative,\n unwrapNative,\n sweep,\n sweepNative,\n // Deprecated\n uniswapV3,\n oneInch,\n claimRewards,\n // Deprecated\n gaugeDeposit,\n borrower,\n swapper,\n mint4626,\n deposit4626,\n redeem4626,\n withdraw4626,\n // Deprecated\n prepareRedeemSavingsRate,\n // Deprecated\n claimRedeemSavingsRate,\n // Deprecated\n swapIn,\n // Deprecated\n swapOut,\n claimWeeklyInterest,\n // Deprecated\n withdraw,\n // Deprecated\n mint,\n // Deprecated\n deposit,\n // Deprecated\n openPerpetual,\n // Deprecated\n addToPerpetual,\n veANGLEDeposit,\n // Deprecated\n claimRewardsWithPerps,\n deposit4626Referral\n}\n\n/// @notice Data needed to get permits\nstruct PermitType {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @notice Data to grant permit to the router for a vault\nstruct PermitVaultManagerType {\n address vaultManager;\n address owner;\n bool approved;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @title BaseRouter\n/// @author Angle Core Team\n/// @notice Base contract that Angle router contracts on different chains should override\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\n using SafeERC20 for IERC20;\n\n // ================================= REFERENCES ================================\n\n /// @notice Core address handling access control\n ICoreBorrow public core;\n /// @notice Address of the router used for swaps\n IUniswapV3Router public uniswapV3Router;\n /// @notice Address of 1Inch router used for swaps\n address public oneInch;\n\n uint256[47] private __gap;\n\n // ============================== EVENTS / ERRORS ==============================\n\n error IncompatibleLengths();\n error InvalidReturnMessage();\n error NotApprovedOrOwner();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error TooSmallAmountOut();\n error TransferFailed();\n error ZeroAddress();\n\n event ReferredDeposit(\n address caller,\n address indexed owner,\n uint256 assets,\n uint256 shares,\n address indexed savings,\n address indexed referrer\n );\n\n /// @notice Deploys the router contract on a chain\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\n if (_core == address(0)) revert ZeroAddress();\n core = ICoreBorrow(_core);\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\n oneInch = _oneInch;\n }\n\n constructor() initializer {}\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @notice Allows composable calls to different functions within the protocol\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\n /// @param actions List of actions to be performed by the router (in order of execution)\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\n /// for a given action are stored\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\n /// do not perform a sweep action on these tokens\n function mixer(\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) public payable virtual {\n // If all tokens have already been approved, there's no need for this step\n uint256 permitsLength = paramsPermit.length;\n for (uint256 i; i < permitsLength; ++i) {\n IERC20Permit(paramsPermit[i].token).permit(\n paramsPermit[i].owner,\n address(this),\n paramsPermit[i].value,\n paramsPermit[i].deadline,\n paramsPermit[i].v,\n paramsPermit[i].r,\n paramsPermit[i].s\n );\n }\n // Performing actions one after the others\n uint256 actionsLength = actions.length;\n for (uint256 i; i < actionsLength; ++i) {\n if (actions[i] == ActionType.transfer) {\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\n } else if (actions[i] == ActionType.wrapNative) {\n _wrapNative();\n } else if (actions[i] == ActionType.unwrapNative) {\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\n _unwrapNative(minAmountOut, to);\n } else if (actions[i] == ActionType.sweep) {\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\n _sweep(tokenOut, minAmountOut, to);\n } else if (actions[i] == ActionType.sweepNative) {\n uint256 routerBalance = address(this).balance;\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\n } else if (actions[i] == ActionType.oneInch) {\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\n data[i],\n (address, uint256, bytes)\n );\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\n } else if (actions[i] == ActionType.claimRewards) {\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\n _claimRewards(user, claimLiquidityGauges);\n } else if (actions[i] == ActionType.borrower) {\n (\n address collateral,\n address vaultManager,\n address to,\n address who,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n bytes memory repayData\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\n } else if (actions[i] == ActionType.swapper) {\n (\n ISwapper swapperContract,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory payload\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\n } else if (actions[i] == ActionType.mint4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _mint4626(savingsRate, shares, to, maxAmountIn);\n } else if (actions[i] == ActionType.deposit4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626(savingsRate, amount, to, minSharesOut);\n } else if (actions[i] == ActionType.deposit4626Referral) {\n (\n IERC20 token,\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\n } else if (actions[i] == ActionType.redeem4626) {\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _redeem4626(savingsRate, shares, to, minAmountOut);\n } else if (actions[i] == ActionType.withdraw4626) {\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\n } else {\n _chainSpecificAction(actions[i], data[i]);\n }\n }\n }\n\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\n /// addresses depositing from a certain referring address into an ERC4626 contract\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n _changeAllowance(IERC20(token), savings, type(uint256).max);\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\n }\n\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\n /// actions and then revoking this approval after these actions\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\n /// to revoke approvals\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\n /// is just an option\n function mixerVaultManagerPermit(\n PermitVaultManagerType[] memory paramsPermitVaultManager,\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) external payable virtual {\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n true,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n } else break;\n }\n mixer(paramsPermit, actions, data);\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\n // too deep\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (!paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n false,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n }\n }\n }\n\n receive() external payable {}\n\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\n\n /// @notice Wraps the native token of a chain to its wrapped version\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\n /// @dev The amount to wrap is to be specified in the `msg.value`\n function _wrapNative() internal virtual returns (uint256) {\n _getNativeWrapper().deposit{ value: msg.value }();\n return msg.value;\n }\n\n /// @notice Unwraps the wrapped version of a token to the native chain token\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\n amount = _getNativeWrapper().balanceOf(address(this));\n _slippageCheck(amount, minAmountOut);\n if (amount != 0) {\n _getNativeWrapper().withdraw(amount);\n _safeTransferNative(to, amount);\n }\n return amount;\n }\n\n /// @notice Internal version of the `claimRewards` function\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\n uint256 gaugesLength = liquidityGauges.length;\n for (uint256 i; i < gaugesLength; ++i) {\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\n }\n }\n\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\n /// @param vaultManager Address of the vault to perform actions on\n /// @param actionsBorrow Actions type to perform on the vaultManager\n /// @param dataBorrow Data needed for each actions\n /// @param to Address to send the funds to\n /// @param who Swapper address to handle repayments\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\n function _angleBorrower(\n address vaultManager,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address to,\n address who,\n bytes memory repayData\n ) internal virtual returns (PaymentData memory paymentData) {\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\n }\n\n /// @notice Sweeps tokens from the router contract\n /// @param tokenOut Token to sweep\n /// @param minAmountOut Minimum amount of tokens to recover\n /// @param to Address to which tokens should be sent\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\n _slippageCheck(balanceToken, minAmountOut);\n if (balanceToken != 0) {\n IERC20(tokenOut).safeTransfer(to, balanceToken);\n }\n }\n\n /// @notice Uses an external swapper\n /// @param swapper Contracts implementing the logic of the swap\n /// @param inToken Token used to do the swap\n /// @param outToken Token wanted\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\n /// @param inTokenObtained Amount of `inToken` used for the swap\n /// @param data Additional info for the specific swapper\n function _swapper(\n ISwapper swapper,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) internal {\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\n }\n\n /// @notice Swaps an inToken to another token via 1Inch Router\n /// @param payload Bytes needed for 1Inch router to process the swap\n /// @dev The `payload` given is expected to be obtained from 1Inch API\n function _swapOn1Inch(\n IERC20 inToken,\n uint256 minAmountOut,\n bytes memory payload\n ) internal returns (uint256 amountOut) {\n // Approve transfer to the `oneInch` address\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\n address oneInchRouter = oneInch;\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\n //solhint-disable-next-line\n (bool success, bytes memory result) = oneInchRouter.call(payload);\n if (!success) _revertBytes(result);\n\n amountOut = abi.decode(result, (uint256));\n _slippageCheck(amountOut, minAmountOut);\n }\n\n /// @notice Mints `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to mint shares from\n /// @param shares Amount of shares to mint from the contract\n /// @param to Address to which shares should be sent\n /// @param maxAmountIn Max amount of assets used to mint\n /// @return amountIn Amount of assets used to mint by `to`\n function _mint4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 maxAmountIn\n ) internal returns (uint256 amountIn) {\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\n }\n\n /// @notice Deposits `amount` to an ERC4626 contract\n /// @param savingsRate The ERC4626 to deposit assets to\n /// @param amount Amount of assets to deposit\n /// @param to Address to which shares should be sent\n /// @param minSharesOut Minimum amount of shares that `to` should received\n /// @return sharesOut Amount of shares received by `to`\n function _deposit4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\n }\n\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\n function _deposit4626Referral(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) internal returns (uint256 sharesOut) {\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\n }\n\n /// @notice Withdraws `amount` from an ERC4626 contract\n /// @param savingsRate ERC4626 to withdraw assets from\n /// @param amount Amount of assets to withdraw\n /// @param to Destination of assets\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\n /// @return sharesOut Amount of shares burnt\n function _withdraw4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 maxSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\n }\n\n /// @notice Redeems `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to redeem shares from\n /// @param shares Amount of shares to redeem\n /// @param to Destination of assets\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\n /// @return amountOut Amount of assets received by `to`\n function _redeem4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 minAmountOut\n ) internal returns (uint256 amountOut) {\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\n }\n\n /// @notice Allows to perform some specific actions for a chain\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\n\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\n\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\n\n // ============================ GOVERNANCE FUNCTION ============================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Sets a new `core` contract\n function setCore(ICoreBorrow _core) external {\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\n core = ICoreBorrow(_core);\n }\n\n /// @notice Changes allowances for different tokens\n /// @param tokens Addresses of the tokens to allow\n /// @param spenders Addresses to allow transfer\n /// @param amounts Amounts to allow\n function changeAllowance(\n IERC20[] calldata tokens,\n address[] calldata spenders,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\n for (uint256 i; i < tokensLength; ++i) {\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\n }\n }\n\n /// @notice Sets a new router variable\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\n if (router == address(0)) revert ZeroAddress();\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\n else oneInch = router;\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Changes allowance of this contract for a given token\n /// @param token Address of the token to change allowance\n /// @param spender Address to change the allowance of\n /// @param amount Amount allowed\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\n uint256 currentAllowance = token.allowance(address(this), spender);\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\n } else if (currentAllowance > amount) {\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\n }\n }\n\n /// @notice Transfer amount of the native token to the `to` address\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\n function _safeTransferNative(address to, uint256 amount) internal {\n bool success;\n //solhint-disable-next-line\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) revert TransferFailed();\n }\n\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\n /// the calling address is well approved for all the vaults with which it is interacting\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\n /// with a vault are approved for this vault\n function _parseVaultIDs(\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address vaultManager,\n address collateral\n ) internal view returns (bytes[] memory) {\n uint256 actionsBorrowLength = actionsBorrow.length;\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\n bool createVaultAction;\n uint256 lastVaultID;\n uint256 vaultIDLength;\n for (uint256 i; i < actionsBorrowLength; ++i) {\n uint256 vaultID;\n // If there is a `createVault` action, the router should not worry about looking at\n // next vaultIDs given equal to 0\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\n createVaultAction = true;\n continue;\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\n // as collateral the full contract balance\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\n uint256 amount;\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\n if (amount == type(uint256).max)\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\n continue;\n // There are different ways depending on the action to find the `vaultID` to parse\n } else if (\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\n ) {\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\n vaultID = abi.decode(dataBorrow[i], (uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\n } else continue;\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\n // if there has not been any specific action\n if (vaultID == 0) {\n if (createVaultAction) {\n continue;\n } else {\n // If we haven't stored the last `vaultID`, we need to fetch it\n if (lastVaultID == 0) {\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\n }\n vaultID = lastVaultID;\n }\n }\n\n // Check if this `vaultID` has already been verified\n for (uint256 j; j < vaultIDLength; ++j) {\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\n // If yes, we continue to the next iteration\n continue;\n }\n }\n // Verify this new `vaultID` and add it to the list\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\n revert NotApprovedOrOwner();\n }\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\n vaultIDLength += 1;\n }\n return dataBorrow;\n }\n\n /// @notice Checks whether the amount obtained during a swap is not too small\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\n if (amount < thresholdAmount) revert TooSmallAmountOut();\n }\n\n /// @notice Internal function used for error handling\n function _revertBytes(bytes memory errMsg) internal pure {\n if (errMsg.length != 0) {\n //solhint-disable-next-line\n assembly {\n revert(add(32, errMsg), mload(errMsg))\n }\n }\n revert InvalidReturnMessage();\n }\n}\n" + }, + "contracts/implementations/arbitrum/AngleRouterArbitrum.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterArbitrum\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\ncontract AngleRouterArbitrum is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n }\n}\n" + }, + "contracts/implementations/avalanche/AngleRouterAvalanche.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterAvalanche\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Avalanche\ncontract AngleRouterAvalanche is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n }\n}\n" + }, + "contracts/implementations/base/AngleRouterBase.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterBase\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Base\ncontract AngleRouterBase is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/celo/AngleRouterCelo.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterCelo\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Celo\ncontract AngleRouterCelo is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0000000000000000000000000000000000000000);\n }\n}\n" + }, + "contracts/implementations/gnosis/AngleRouterGnosis.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterGnosis\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Gnosis\ncontract AngleRouterGnosis is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n }\n}\n" + }, + "contracts/implementations/mainnet/AngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../interfaces/IFeeDistributorFront.sol\";\nimport \"../../interfaces/ISanToken.sol\";\nimport \"../../interfaces/IStableMasterFront.sol\";\nimport \"../../interfaces/IVeANGLE.sol\";\n\nimport \"../../BaseRouter.sol\";\n\n// ============================= STRUCTS AND ENUMS =============================\n\n/// @notice References to the contracts associated to a collateral for a stablecoin\nstruct Pairs {\n IPoolManager poolManager;\n IPerpetualManagerFrontWithClaim perpetualManager;\n ISanToken sanToken;\n ILiquidityGauge gauge;\n}\n\n/// @title AngleRouterMainnet\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Ethereum\n/// @dev Previous implementation with an initialization function can be found here:\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\ncontract AngleRouterMainnet is BaseRouter {\n using SafeERC20 for IERC20;\n\n // =================================== ERRORS ==================================\n\n error InvalidParams();\n\n // ================================== MAPPINGS =================================\n\n /// @notice Maps an agToken to its counterpart `StableMaster`\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\n\n uint256[48] private __gapMainnet;\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @inheritdoc BaseRouter\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\n if (action == ActionType.claimWeeklyInterest) {\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\n } else if (action == ActionType.veANGLEDeposit) {\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\n _depositOnLocker(user, amount);\n }\n }\n\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n }\n\n /// @notice Deposits ANGLE on an existing locker\n /// @param user Address to deposit for\n /// @param amount Amount to deposit\n function _depositOnLocker(address user, uint256 amount) internal {\n _getVeANGLE().deposit_for(user, amount);\n }\n\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\n /// @param user Address to claim for\n /// @param _feeDistributor Address of the fee distributor to claim to\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\n /// transfer the token claimed from the `feeDistributor`\n function _claimWeeklyInterest(\n address user,\n IFeeDistributorFront _feeDistributor,\n bool letInContract\n ) internal {\n uint256 amount = _feeDistributor.claim(user);\n if (letInContract) {\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\n IERC20 token = IERC20(_feeDistributor.token());\n token.safeTransferFrom(msg.sender, address(this), amount);\n }\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Returns the veANGLE address\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\n }\n}\n" + }, + "contracts/implementations/optimism/AngleRouterOptimism.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterOptimism\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Optimism\ncontract AngleRouterOptimism is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/polygon/AngleRouterPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterPolygon\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Polygon\ncontract AngleRouterPolygon is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n }\n}\n" + }, + "contracts/interfaces/external/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nstruct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n}\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IUniswapV3Router {\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n\n/// @title Router for price estimation functionality\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\n/// @dev This interface is only used for non critical elements of the protocol\ninterface IUniswapV2Router {\n /// @notice Given an input asset amount, returns the maximum output amount of the\n /// other asset (accounting for fees) given reserves.\n /// @param path Addresses of the pools used to get prices\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokens(\n uint256 swapAmount,\n uint256 minExpected,\n address[] calldata path,\n address receiver,\n uint256 swapDeadline\n ) external;\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICoreBorrow\n/// @author Angle Core Team\n/// @notice Interface for the `CoreBorrow` contract\n\ninterface ICoreBorrow {\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IDepositWithReferral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title IDepositWithReferral\n/// @author Angle Core Team\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\ninterface IDepositWithReferral {\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\n /// obtained, the function reverts\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\n /// when a deposit takes place\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut);\n}\n" + }, + "contracts/interfaces/IFeeDistributorFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IFeeDistributorFront\n/// @author Interface for public use of the `FeeDistributor` contract\n/// @dev This interface is used for user related function\ninterface IFeeDistributorFront {\n function token() external returns (address);\n\n function claim(address _addr) external returns (uint256);\n\n function claim(address[20] memory _addr) external returns (bool);\n}\n" + }, + "contracts/interfaces/ILiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function staking_token() external returns (address stakingToken);\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external;\n}\n" + }, + "contracts/interfaces/IPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title Interface of the contract managing perpetuals with claim function\n/// @author Angle Core Team\n/// @dev Front interface with rewards function, meaning only user-facing functions\ninterface IPerpetualManagerFrontWithClaim {\n function getReward(uint256 perpetualID) external;\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\n\n function openPerpetual(\n address owner,\n uint256 amountBrought,\n uint256 amountCommitted,\n uint256 maxOracleRate,\n uint256 minNetMargin\n ) external returns (uint256 perpetualID);\n}\n" + }, + "contracts/interfaces/IPoolManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IPoolManager {\n function token() external view returns (address);\n}\n" + }, + "contracts/interfaces/ISanToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ISanToken is IERC20Upgradeable {}\n" + }, + "contracts/interfaces/IStableMasterFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IPoolManager.sol\";\nimport \"./ISanToken.sol\";\nimport \"./IPerpetualManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Struct to handle all the parameters to manage the fees\n// related to a given collateral pool (associated to the stablecoin)\nstruct MintBurnData {\n // Values of the thresholds to compute the minting fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeMint;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeMint;\n // Values of the thresholds to compute the burning fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeBurn;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeBurn;\n // Max proportion of collateral from users that can be covered by HAs\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\n // the other changes accordingly\n uint64 targetHAHedge;\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusMint;\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusBurn;\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\n uint256 capOnStableMinted;\n}\n\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\n// including the fraction of interests they receive or the fees to be distributed to\n// them\nstruct SLPData {\n // Last timestamp at which the `sanRate` has been updated for SLPs\n uint256 lastBlockUpdated;\n // Fees accumulated from previous blocks and to be distributed to SLPs\n uint256 lockedInterests;\n // Max interests used to update the `sanRate` in a single block\n // Should be in collateral token base\n uint256 maxInterestsDistributed;\n // Amount of fees left aside for SLPs and that will be distributed\n // when the protocol is collateralized back again\n uint256 feesAside;\n // Part of the fees normally going to SLPs that is left aside\n // before the protocol is collateralized back again (depends on collateral ratio)\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippageFee;\n // Portion of the fees from users minting and burning\n // that goes to SLPs (the rest goes to surplus)\n uint64 feesForSLPs;\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippage;\n // Portion of the interests from lending\n // that goes to SLPs (the rest goes to surplus)\n uint64 interestsForSLPs;\n}\n\n/// @title IStableMasterFront\n/// @author Angle Core Team\n/// @dev Front interface, meaning only user-facing functions\ninterface IStableMasterFront {\n function collateralMap(IPoolManager poolManager)\n external\n view\n returns (\n IERC20 token,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n address oracle,\n uint256 stocksUsers,\n uint256 sanRate,\n uint256 collatBase,\n SLPData memory slpData,\n MintBurnData memory feeData\n );\n\n function updateStocksUsers(uint256 amount, address poolManager) external;\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256 minStableAmount\n ) external;\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256 minCollatAmount\n ) external;\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external;\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external;\n\n function agToken() external returns (address);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Core Team\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\ninterface ISwapper {\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager``\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\n uint256 normalizedDebt;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionBorrowType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IVeANGLE\n/// @author Angle Core Team\n/// @notice Interface for the `VeANGLE` contract\ninterface IVeANGLE {\n // solhint-disable-next-line func-name-mixedcase\n function deposit_for(address addr, uint256 amount) external;\n}\n" + }, + "contracts/mock/MockAngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../implementations/mainnet/AngleRouterMainnet.sol\";\n\ncontract MockAngleRouterMainnet is AngleRouterMainnet {\n address public veAngle;\n\n function setAngleAndVeANGLE(address _veAngle) external {\n veAngle = _veAngle;\n }\n\n function _getVeANGLE() internal view override returns (IVeANGLE) {\n return IVeANGLE(veAngle);\n }\n\n function addStableMaster(IERC20 stablecoin, IStableMasterFront stableMaster) external {\n mapStableMasters[stablecoin] = stableMaster;\n }\n\n function addPairs(\n IERC20[] calldata stablecoins,\n IPoolManager[] calldata poolManagers,\n ILiquidityGauge[] calldata liquidityGauges,\n bool[] calldata justLiquidityGauges\n ) external {\n for (uint256 i; i < stablecoins.length; ++i) {\n IStableMasterFront stableMaster = mapStableMasters[stablecoins[i]];\n _addPair(stableMaster, poolManagers[i], liquidityGauges[i], justLiquidityGauges[i]);\n }\n }\n\n function _addPair(\n IStableMasterFront stableMaster,\n IPoolManager poolManager,\n ILiquidityGauge liquidityGauge,\n bool justLiquidityGauge\n ) internal {\n // Fetching the associated `sanToken` and `perpetualManager` from the contract\n (\n IERC20 collateral,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n ,\n ,\n ,\n ,\n ,\n\n ) = stableMaster.collateralMap(poolManager);\n // Reverting if the poolManager is not a valid `poolManager`\n if (address(collateral) == address(0)) revert InvalidParams();\n Pairs storage _pairs = mapPoolManagers[stableMaster][collateral];\n if (justLiquidityGauge) {\n // Cannot specify a liquidity gauge if the associated poolManager does not exist\n if (address(_pairs.poolManager) == address(0)) revert ZeroAddress();\n ILiquidityGauge gauge = _pairs.gauge;\n if (address(gauge) != address(0)) {\n _changeAllowance(IERC20(address(sanToken)), address(gauge), 0);\n }\n } else {\n // Checking if the pair has not already been initialized: if yes we need to make the function revert\n // otherwise we could end up with still approved `PoolManager` and `PerpetualManager` contracts\n if (address(_pairs.poolManager) != address(0)) revert InvalidParams();\n _pairs.poolManager = poolManager;\n _pairs.perpetualManager = IPerpetualManagerFrontWithClaim(address(perpetualManager));\n _pairs.sanToken = sanToken;\n _changeAllowance(collateral, address(stableMaster), type(uint256).max);\n _changeAllowance(collateral, address(perpetualManager), type(uint256).max);\n }\n _pairs.gauge = liquidityGauge;\n if (address(liquidityGauge) != address(0)) {\n if (address(sanToken) != liquidityGauge.staking_token()) revert InvalidParams();\n _changeAllowance(IERC20(address(sanToken)), address(liquidityGauge), type(uint256).max);\n }\n }\n}\n\ncontract MockAngleRouterMainnet2 is AngleRouterMainnet {\n function getVeANGLE() external view returns (IVeANGLE) {\n return _getVeANGLE();\n }\n}\n" + }, + "contracts/mock/MockRouterSidechain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/external/IWETH9.sol\";\n\nimport \"../BaseRouter.sol\";\n\n/// @title MockRouterSidechain\n/// @author Angle Core Team\n/// @notice Mock contract but built for tests as if to be deployed on Ethereum\ncontract MockRouterSidechain is BaseRouter {\n IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function _wrapNative() internal pure override returns (uint256) {\n return 0;\n }\n\n function _unwrapNative(uint256, address) internal pure override returns (uint256 amount) {\n return 0;\n }\n\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return WETH;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/deployments/polygon/AngleRouterPolygonV3_0_Implementation.json b/deployments/polygon/AngleRouterPolygonV3_0_Implementation.json new file mode 100644 index 0000000..46714b6 --- /dev/null +++ b/deployments/polygon/AngleRouterPolygonV3_0_Implementation.json @@ -0,0 +1,633 @@ +{ + "address": "0x34092DdDA8b7e803Ae4009838cf8c00F1C786F8c", + "abi": [ + { + "inputs": [], + "name": "IncompatibleLengths", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidReturnMessage", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernor", + "type": "error" + }, + { + "inputs": [], + "name": "NotGovernorOrGuardian", + "type": "error" + }, + { + "inputs": [], + "name": "TooSmallAmountOut", + "type": "error" + }, + { + "inputs": [], + "name": "TransferFailed", + "type": "error" + }, + { + "inputs": [], + "name": "ZeroAddress", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "caller", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "assets", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "shares", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "ReferredDeposit", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "contract IERC20[]", + "name": "tokens", + "type": "address[]" + }, + { + "internalType": "address[]", + "name": "spenders", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + } + ], + "name": "changeAllowance", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "core", + "outputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "savings", + "type": "address" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "minSharesOut", + "type": "uint256" + }, + { + "internalType": "address", + "name": "referrer", + "type": "address" + } + ], + "name": "deposit4626Referral", + "outputs": [ + { + "internalType": "uint256", + "name": "sharesOut", + "type": "uint256" + } + ], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_core", + "type": "address" + }, + { + "internalType": "address", + "name": "_uniswapRouter", + "type": "address" + }, + { + "internalType": "address", + "name": "_oneInch", + "type": "address" + } + ], + "name": "initializeRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixer", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "address", + "name": "vaultManager", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitVaultManagerType[]", + "name": "paramsPermitVaultManager", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "address", + "name": "token", + "type": "address" + }, + { + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "deadline", + "type": "uint256" + }, + { + "internalType": "uint8", + "name": "v", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "r", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "s", + "type": "bytes32" + } + ], + "internalType": "struct PermitType[]", + "name": "paramsPermit", + "type": "tuple[]" + }, + { + "internalType": "enum ActionType[]", + "name": "actions", + "type": "uint8[]" + }, + { + "internalType": "bytes[]", + "name": "data", + "type": "bytes[]" + } + ], + "name": "mixerVaultManagerPermit", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [], + "name": "oneInch", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ICoreBorrow", + "name": "_core", + "type": "address" + } + ], + "name": "setCore", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "router", + "type": "address" + }, + { + "internalType": "uint8", + "name": "who", + "type": "uint8" + } + ], + "name": "setRouter", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "uniswapV3Router", + "outputs": [ + { + "internalType": "contract IUniswapV3Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "stateMutability": "payable", + "type": "receive" + } + ], + "transactionHash": "0xeadf9d20a3f56931e3c146329f804028f7d0b3d726e42e1743c5d68c0311bf36", + "receipt": { + "to": null, + "from": "0xA9DdD91249DFdd450E81E1c56Ab60E1A62651701", + "contractAddress": "0x34092DdDA8b7e803Ae4009838cf8c00F1C786F8c", + "transactionIndex": 100, + "gasUsed": "3564890", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000008000000400000000000000000000000080000000000000000000000000800000000000000000000100000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000080000000000000280000a00000000000000000000000000400000000000000000000800000080200004000000000000000000001000000040000000000000000000000100000000000000000000000000000000000000000000000000000000000000000000000100000", + "blockHash": "0x913e2ab902d56b17b5fea11d6ea08b0460c9504b9d71017e462703aa41f355c1", + "transactionHash": "0xeadf9d20a3f56931e3c146329f804028f7d0b3d726e42e1743c5d68c0311bf36", + "logs": [ + { + "transactionIndex": 100, + "blockNumber": 56913809, + "transactionHash": "0xeadf9d20a3f56931e3c146329f804028f7d0b3d726e42e1743c5d68c0311bf36", + "address": "0x34092DdDA8b7e803Ae4009838cf8c00F1C786F8c", + "topics": [ + "0x7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498" + ], + "data": "0x0000000000000000000000000000000000000000000000000000000000000001", + "logIndex": 420, + "blockHash": "0x913e2ab902d56b17b5fea11d6ea08b0460c9504b9d71017e462703aa41f355c1" + }, + { + "transactionIndex": 100, + "blockNumber": 56913809, + "transactionHash": "0xeadf9d20a3f56931e3c146329f804028f7d0b3d726e42e1743c5d68c0311bf36", + "address": "0x0000000000000000000000000000000000001010", + "topics": [ + "0x4dfe1bbbcf077ddc3e01291eea2d5c70c2b422b415d95645b9adcfd678cb1d63", + "0x0000000000000000000000000000000000000000000000000000000000001010", + "0x000000000000000000000000a9ddd91249dfdd450e81e1c56ab60e1a62651701", + "0x000000000000000000000000f0245f6251bef9447a08766b9da2b07b28ad80b0" + ], + "data": "0x000000000000000000000000000000000000000000000000017fc021b008c6000000000000000000000000000000000000000000000000001382b200deec16cb00000000000000000000000000000000000000000000051ec23e3ff27eaee0c00000000000000000000000000000000000000000000000001202f1df2ee350cb00000000000000000000000000000000000000000000051ec3be00142eb7a6c0", + "logIndex": 421, + "blockHash": "0x913e2ab902d56b17b5fea11d6ea08b0460c9504b9d71017e462703aa41f355c1" + } + ], + "blockNumber": 56913809, + "cumulativeGasUsed": "14643564", + "status": 1, + "byzantium": true + }, + "args": [], + "numDeployments": 1, + "solcInputHash": "0d1b1c94fd2e1964436c8b9a0e25c545", + "metadata": "{\"compiler\":{\"version\":\"0.8.17+commit.8df45f5f\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"IncompatibleLengths\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"InvalidReturnMessage\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotApprovedOrOwner\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernor\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"NotGovernorOrGuardian\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TooSmallAmountOut\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"TransferFailed\",\"type\":\"error\"},{\"inputs\":[],\"name\":\"ZeroAddress\",\"type\":\"error\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"version\",\"type\":\"uint8\"}],\"name\":\"Initialized\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"address\",\"name\":\"caller\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"assets\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"shares\",\"type\":\"uint256\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"indexed\":true,\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"ReferredDeposit\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"contract IERC20[]\",\"name\":\"tokens\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"spenders\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"amounts\",\"type\":\"uint256[]\"}],\"name\":\"changeAllowance\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"core\",\"outputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"savings\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"amount\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"to\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"minSharesOut\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"referrer\",\"type\":\"address\"}],\"name\":\"deposit4626Referral\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"sharesOut\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_core\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_uniswapRouter\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_oneInch\",\"type\":\"address\"}],\"name\":\"initializeRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixer\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[{\"components\":[{\"internalType\":\"address\",\"name\":\"vaultManager\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"bool\",\"name\":\"approved\",\"type\":\"bool\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitVaultManagerType[]\",\"name\":\"paramsPermitVaultManager\",\"type\":\"tuple[]\"},{\"components\":[{\"internalType\":\"address\",\"name\":\"token\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"owner\",\"type\":\"address\"},{\"internalType\":\"uint256\",\"name\":\"value\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"deadline\",\"type\":\"uint256\"},{\"internalType\":\"uint8\",\"name\":\"v\",\"type\":\"uint8\"},{\"internalType\":\"bytes32\",\"name\":\"r\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"s\",\"type\":\"bytes32\"}],\"internalType\":\"struct PermitType[]\",\"name\":\"paramsPermit\",\"type\":\"tuple[]\"},{\"internalType\":\"enum ActionType[]\",\"name\":\"actions\",\"type\":\"uint8[]\"},{\"internalType\":\"bytes[]\",\"name\":\"data\",\"type\":\"bytes[]\"}],\"name\":\"mixerVaultManagerPermit\",\"outputs\":[],\"stateMutability\":\"payable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"oneInch\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"contract ICoreBorrow\",\"name\":\"_core\",\"type\":\"address\"}],\"name\":\"setCore\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"router\",\"type\":\"address\"},{\"internalType\":\"uint8\",\"name\":\"who\",\"type\":\"uint8\"}],\"name\":\"setRouter\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"uniswapV3Router\",\"outputs\":[{\"internalType\":\"contract IUniswapV3Router\",\"name\":\"\",\"type\":\"address\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"stateMutability\":\"payable\",\"type\":\"receive\"}],\"devdoc\":{\"author\":\"Angle Core Team\",\"kind\":\"dev\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"params\":{\"amounts\":\"Amounts to allow\",\"spenders\":\"Addresses to allow transfer\",\"tokens\":\"Addresses of the tokens to allow\"}},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens\",\"params\":{\"actions\":\"List of actions to be performed by the router (in order of execution)\",\"data\":\"Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored\",\"paramsPermit\":\"Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\"}},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"details\":\"In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option\",\"params\":{\"paramsPermitVaultManager\":\"Parameters to sign permit to give allowance to the router for a `VaultManager` contract\"}}},\"title\":\"AngleRouterPolygon\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"changeAllowance(address[],address[],uint256[])\":{\"notice\":\"Changes allowances for different tokens\"},\"core()\":{\"notice\":\"Core address handling access control\"},\"deposit4626Referral(address,address,uint256,address,uint256,address)\":{\"notice\":\"Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract\"},\"initializeRouter(address,address,address)\":{\"notice\":\"Deploys the router contract on a chain\"},\"mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Allows composable calls to different functions within the protocol\"},\"mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])\":{\"notice\":\"Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions\"},\"oneInch()\":{\"notice\":\"Address of 1Inch router used for swaps\"},\"setCore(address)\":{\"notice\":\"Sets a new `core` contract\"},\"setRouter(address,uint8)\":{\"notice\":\"Sets a new router variable\"},\"uniswapV3Router()\":{\"notice\":\"Address of the router used for swaps\"}},\"notice\":\"Router contract built specifially for Angle use cases on Polygon\",\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/implementations/polygon/AngleRouterPolygon.sol\":\"AngleRouterPolygon\"},\"evmVersion\":\"london\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":1000000},\"remappings\":[]},\"sources\":{\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\\n\\npragma solidity ^0.8.2;\\n\\nimport \\\"../../utils/AddressUpgradeable.sol\\\";\\n\\n/**\\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\\n *\\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\\n * reused. This mechanism prevents re-execution of each \\\"step\\\" but allows the creation of new initialization steps in\\n * case an upgrade adds a module that needs to be initialized.\\n *\\n * For example:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * contract MyToken is ERC20Upgradeable {\\n * function initialize() initializer public {\\n * __ERC20_init(\\\"MyToken\\\", \\\"MTK\\\");\\n * }\\n * }\\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\\n * function initializeV2() reinitializer(2) public {\\n * __ERC20Permit_init(\\\"MyToken\\\");\\n * }\\n * }\\n * ```\\n *\\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\\n *\\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\\n *\\n * [CAUTION]\\n * ====\\n * Avoid leaving a contract uninitialized.\\n *\\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\\n *\\n * [.hljs-theme-light.nopadding]\\n * ```\\n * /// @custom:oz-upgrades-unsafe-allow constructor\\n * constructor() {\\n * _disableInitializers();\\n * }\\n * ```\\n * ====\\n */\\nabstract contract Initializable {\\n /**\\n * @dev Indicates that the contract has been initialized.\\n * @custom:oz-retyped-from bool\\n */\\n uint8 private _initialized;\\n\\n /**\\n * @dev Indicates that the contract is in the process of being initialized.\\n */\\n bool private _initializing;\\n\\n /**\\n * @dev Triggered when the contract has been initialized or reinitialized.\\n */\\n event Initialized(uint8 version);\\n\\n /**\\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\\n */\\n modifier initializer() {\\n bool isTopLevelCall = !_initializing;\\n require(\\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\\n \\\"Initializable: contract is already initialized\\\"\\n );\\n _initialized = 1;\\n if (isTopLevelCall) {\\n _initializing = true;\\n }\\n _;\\n if (isTopLevelCall) {\\n _initializing = false;\\n emit Initialized(1);\\n }\\n }\\n\\n /**\\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\\n * used to initialize parent contracts.\\n *\\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\\n * initialization step. This is essential to configure modules that are added through upgrades and that require\\n * initialization.\\n *\\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\\n * a contract, executing them in the right order is up to the developer or operator.\\n */\\n modifier reinitializer(uint8 version) {\\n require(!_initializing && _initialized < version, \\\"Initializable: contract is already initialized\\\");\\n _initialized = version;\\n _initializing = true;\\n _;\\n _initializing = false;\\n emit Initialized(version);\\n }\\n\\n /**\\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\\n */\\n modifier onlyInitializing() {\\n require(_initializing, \\\"Initializable: contract is not initializing\\\");\\n _;\\n }\\n\\n /**\\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\\n * through proxies.\\n */\\n function _disableInitializers() internal virtual {\\n require(!_initializing, \\\"Initializable: contract is initializing\\\");\\n if (_initialized < type(uint8).max) {\\n _initialized = type(uint8).max;\\n emit Initialized(type(uint8).max);\\n }\\n }\\n}\\n\",\"keccak256\":\"0x0203dcadc5737d9ef2c211d6fa15d18ebc3b30dfa51903b64870b01a062b0b4e\",\"license\":\"MIT\"},\"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\n\\n/**\\n * @dev Collection of functions related to the address type\\n */\\nlibrary AddressUpgradeable {\\n /**\\n * @dev Returns true if `account` is a contract.\\n *\\n * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0x611aa3f23e59cfdd1863c536776407b3e33d695152a266fa7cfb34440a29a8a3\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\n\",\"keccak256\":\"0x6ebf1944ab804b8660eb6fc52f9fe84588cee01c2566a69023e59497e7d27f45\",\"license\":\"MIT\"},\"@openzeppelin/contracts/interfaces/IERC4626.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../token/ERC20/IERC20.sol\\\";\\nimport \\\"../token/ERC20/extensions/IERC20Metadata.sol\\\";\\n\\n/**\\n * @dev Interface of the ERC4626 \\\"Tokenized Vault Standard\\\", as defined in\\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\\n *\\n * _Available since v4.7._\\n */\\ninterface IERC4626 is IERC20, IERC20Metadata {\\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\\n\\n event Withdraw(\\n address indexed caller,\\n address indexed receiver,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares\\n );\\n\\n /**\\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\\n *\\n * - MUST be an ERC-20 token contract.\\n * - MUST NOT revert.\\n */\\n function asset() external view returns (address assetTokenAddress);\\n\\n /**\\n * @dev Returns the total amount of the underlying asset that is \\u201cmanaged\\u201d by Vault.\\n *\\n * - SHOULD include any compounding that occurs from yield.\\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT revert.\\n */\\n function totalAssets() external view returns (uint256 totalManagedAssets);\\n\\n /**\\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToShares(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\\n * scenario where all the conditions are met.\\n *\\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\\n * - MUST NOT show any variations depending on the caller.\\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\\n * - MUST NOT revert.\\n *\\n * NOTE: This calculation MAY NOT reflect the \\u201cper-user\\u201d price-per-share, and instead should reflect the\\n * \\u201caverage-user\\u2019s\\u201d price-per-share, meaning what the average user should expect to see when exchanging to and\\n * from.\\n */\\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\\n * through a deposit call.\\n *\\n * - MUST return a limited value if receiver is subject to some deposit limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\\n * - MUST NOT revert.\\n */\\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\\n * in the same transaction.\\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * deposit execution, and are accounted for during deposit.\\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\\n * - MUST return a limited value if receiver is subject to some mint limit.\\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\\n * - MUST NOT revert.\\n */\\n function maxMint(address receiver) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\\n * current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\\n * same transaction.\\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\\n * would be accepted, regardless if the user has enough tokens approved, etc.\\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\\n */\\n function previewMint(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\\n *\\n * - MUST emit the Deposit event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\\n * execution, and are accounted for during mint.\\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\\n * approving enough underlying tokens to the Vault contract, etc).\\n *\\n * NOTE: most implementations will require pre-approval of the Vault with the Vault\\u2019s underlying asset token.\\n */\\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\\n\\n /**\\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\\n * Vault, through a withdraw call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\\n * called\\n * in the same transaction.\\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\\n */\\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\\n\\n /**\\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * withdraw execution, and are accounted for during withdraw.\\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function withdraw(\\n uint256 assets,\\n address receiver,\\n address owner\\n ) external returns (uint256 shares);\\n\\n /**\\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\\n * through a redeem call.\\n *\\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\\n * - MUST NOT revert.\\n */\\n function maxRedeem(address owner) external view returns (uint256 maxShares);\\n\\n /**\\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\\n * given current on-chain conditions.\\n *\\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\\n * same transaction.\\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\\n * redemption would be accepted, regardless if the user has enough shares, etc.\\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\\n * - MUST NOT revert.\\n *\\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\\n */\\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\\n\\n /**\\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\\n *\\n * - MUST emit the Withdraw event.\\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\\n * redeem execution, and are accounted for during redeem.\\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\\n * not having enough shares, etc).\\n *\\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\\n * Those methods should be performed separately.\\n */\\n function redeem(\\n uint256 shares,\\n address receiver,\\n address owner\\n ) external returns (uint256 assets);\\n}\\n\",\"keccak256\":\"0x9750c6fec736eb3320e85924f36a3060fa4a4ab1758d06d9585e175d164eefdb\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/IERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 standard as defined in the EIP.\\n */\\ninterface IERC20 {\\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 /**\\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 `to`.\\n *\\n * Returns a boolean value indicating whether the operation succeeded.\\n *\\n * Emits a {Transfer} event.\\n */\\n function transfer(address to, 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 `from` to `to` 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(\\n address from,\\n address to,\\n uint256 amount\\n ) external returns (bool);\\n}\\n\",\"keccak256\":\"0x9750c6b834f7b43000631af5cc30001c5f547b3ceb3635488f140f60e897ea6b\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\n\\n/**\\n * @dev Interface for the optional metadata functions from the ERC20 standard.\\n *\\n * _Available since v4.1._\\n */\\ninterface IERC20Metadata is IERC20 {\\n /**\\n * @dev Returns the name of the token.\\n */\\n function name() external view returns (string memory);\\n\\n /**\\n * @dev Returns the symbol of the token.\\n */\\n function symbol() external view returns (string memory);\\n\\n /**\\n * @dev Returns the decimals places of the token.\\n */\\n function decimals() external view returns (uint8);\\n}\\n\",\"keccak256\":\"0x8de418a5503946cabe331f35fe242d3201a73f67f77aaeb7110acb1f30423aca\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\\n\\npragma solidity ^0.8.0;\\n\\n/**\\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\\n *\\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\\n * need to send a transaction, and thus is not required to hold Ether at all.\\n */\\ninterface IERC20Permit {\\n /**\\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\\n * given ``owner``'s signed approval.\\n *\\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\\n * ordering also apply here.\\n *\\n * Emits an {Approval} event.\\n *\\n * Requirements:\\n *\\n * - `spender` cannot be the zero address.\\n * - `deadline` must be a timestamp in the future.\\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\\n * over the EIP712-formatted function arguments.\\n * - the signature must use ``owner``'s current nonce (see {nonces}).\\n *\\n * For more information on the signature format, see the\\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\\n * section].\\n */\\n function permit(\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n\\n /**\\n * @dev Returns the current nonce for `owner`. This value must be\\n * included whenever a signature is generated for {permit}.\\n *\\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\\n * prevents a signature from being used multiple times.\\n */\\n function nonces(address owner) external view returns (uint256);\\n\\n /**\\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\\n */\\n // solhint-disable-next-line func-name-mixedcase\\n function DOMAIN_SEPARATOR() external view returns (bytes32);\\n}\\n\",\"keccak256\":\"0xf41ca991f30855bf80ffd11e9347856a517b977f0a6c2d52e6421a99b7840329\",\"license\":\"MIT\"},\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\\n\\npragma solidity ^0.8.0;\\n\\nimport \\\"../IERC20.sol\\\";\\nimport \\\"../extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"../../../utils/Address.sol\\\";\\n\\n/**\\n * @title SafeERC20\\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 IERC20;` statement to your contract,\\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\\n */\\nlibrary SafeERC20 {\\n using Address for address;\\n\\n function safeTransfer(\\n IERC20 token,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\\n }\\n\\n function safeTransferFrom(\\n IERC20 token,\\n address from,\\n address to,\\n uint256 value\\n ) internal {\\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\\n }\\n\\n /**\\n * @dev Deprecated. This function has issues similar to the ones found in\\n * {IERC20-approve}, and its usage is discouraged.\\n *\\n * Whenever possible, use {safeIncreaseAllowance} and\\n * {safeDecreaseAllowance} instead.\\n */\\n function safeApprove(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\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 require(\\n (value == 0) || (token.allowance(address(this), spender) == 0),\\n \\\"SafeERC20: approve from non-zero to non-zero allowance\\\"\\n );\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\\n }\\n\\n function safeIncreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n uint256 newAllowance = token.allowance(address(this), spender) + value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n\\n function safeDecreaseAllowance(\\n IERC20 token,\\n address spender,\\n uint256 value\\n ) internal {\\n unchecked {\\n uint256 oldAllowance = token.allowance(address(this), spender);\\n require(oldAllowance >= value, \\\"SafeERC20: decreased allowance below zero\\\");\\n uint256 newAllowance = oldAllowance - value;\\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\\n }\\n }\\n\\n function safePermit(\\n IERC20Permit token,\\n address owner,\\n address spender,\\n uint256 value,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) internal {\\n uint256 nonceBefore = token.nonces(owner);\\n token.permit(owner, spender, value, deadline, v, r, s);\\n uint256 nonceAfter = token.nonces(owner);\\n require(nonceAfter == nonceBefore + 1, \\\"SafeERC20: permit did not succeed\\\");\\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 */\\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\\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. We use {Address.functionCall} to perform this call, which verifies that\\n // the target address contains contract code and also asserts for success in the low-level call.\\n\\n bytes memory returndata = address(token).functionCall(data, \\\"SafeERC20: low-level call failed\\\");\\n if (returndata.length > 0) {\\n // Return data is optional\\n require(abi.decode(returndata, (bool)), \\\"SafeERC20: ERC20 operation did not succeed\\\");\\n }\\n }\\n}\\n\",\"keccak256\":\"0x032807210d1d7d218963d7355d62e021a84bf1b3339f4f50be2f63b53cccaf29\",\"license\":\"MIT\"},\"@openzeppelin/contracts/utils/Address.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\\n\\npragma solidity ^0.8.1;\\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 * [IMPORTANT]\\n * ====\\n * It is unsafe to assume that an address for which this function returns\\n * false is an externally-owned account (EOA) and not a contract.\\n *\\n * Among others, `isContract` will return false for the following\\n * types of addresses:\\n *\\n * - an externally-owned account\\n * - a contract in construction\\n * - an address where a contract will be created\\n * - an address where a contract lived, but was destroyed\\n * ====\\n *\\n * [IMPORTANT]\\n * ====\\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\\n *\\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\\n * constructor.\\n * ====\\n */\\n function isContract(address account) internal view returns (bool) {\\n // This method relies on extcodesize/address.code.length, which returns 0\\n // for contracts in construction, since the code is only stored at the end\\n // of the constructor execution.\\n\\n return account.code.length > 0;\\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 function sendValue(address payable recipient, uint256 amount) internal {\\n require(address(this).balance >= amount, \\\"Address: insufficient balance\\\");\\n\\n (bool success, ) = recipient.call{value: amount}(\\\"\\\");\\n require(success, \\\"Address: unable to send value, recipient may have reverted\\\");\\n }\\n\\n /**\\n * @dev Performs a Solidity function call using a low level `call`. A\\n * plain `call` is an unsafe replacement for a function call: use this\\n * function instead.\\n *\\n * If `target` reverts with a revert reason, it is bubbled up by this\\n * function (like regular Solidity function calls).\\n *\\n * Returns the raw returned data. To convert to the expected return value,\\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\\n *\\n * Requirements:\\n *\\n * - `target` must be a contract.\\n * - calling `target` with `data` must not revert.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionCall(target, data, \\\"Address: low-level call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\\n * `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, 0, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but also transferring `value` wei to `target`.\\n *\\n * Requirements:\\n *\\n * - the calling contract must have an ETH balance of at least `value`.\\n * - the called Solidity function must be `payable`.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value\\n ) internal returns (bytes memory) {\\n return functionCallWithValue(target, data, value, \\\"Address: low-level call with value failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\\n * with `errorMessage` as a fallback revert reason when `target` reverts.\\n *\\n * _Available since v3.1._\\n */\\n function functionCallWithValue(\\n address target,\\n bytes memory data,\\n uint256 value,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(address(this).balance >= value, \\\"Address: insufficient balance for call\\\");\\n require(isContract(target), \\\"Address: call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.call{value: value}(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\\n return functionStaticCall(target, data, \\\"Address: low-level static call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a static call.\\n *\\n * _Available since v3.3._\\n */\\n function functionStaticCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal view returns (bytes memory) {\\n require(isContract(target), \\\"Address: static call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.staticcall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\\n return functionDelegateCall(target, data, \\\"Address: low-level delegate call failed\\\");\\n }\\n\\n /**\\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\\n * but performing a delegate call.\\n *\\n * _Available since v3.4._\\n */\\n function functionDelegateCall(\\n address target,\\n bytes memory data,\\n string memory errorMessage\\n ) internal returns (bytes memory) {\\n require(isContract(target), \\\"Address: delegate call to non-contract\\\");\\n\\n (bool success, bytes memory returndata) = target.delegatecall(data);\\n return verifyCallResult(success, returndata, errorMessage);\\n }\\n\\n /**\\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\\n * revert reason using the provided one.\\n *\\n * _Available since v4.3._\\n */\\n function verifyCallResult(\\n bool success,\\n bytes memory returndata,\\n string memory errorMessage\\n ) internal pure returns (bytes memory) {\\n if (success) {\\n return returndata;\\n } else {\\n // Look for revert reason and bubble it up if present\\n if (returndata.length > 0) {\\n // The easiest way to bubble the revert reason is using memory via assembly\\n /// @solidity memory-safe-assembly\\n assembly {\\n let returndata_size := mload(returndata)\\n revert(add(32, returndata), returndata_size)\\n }\\n } else {\\n revert(errorMessage);\\n }\\n }\\n }\\n}\\n\",\"keccak256\":\"0xd6153ce99bcdcce22b124f755e72553295be6abcd63804cfdffceb188b8bef10\",\"license\":\"MIT\"},\"contracts/BaseRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\n/*\\n * \\u2588 \\n ***** \\u2593\\u2593\\u2593 \\n * \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///. \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n ***** //////// \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n * ///////////// \\u2593\\u2593\\u2593 \\n \\u2593\\u2593 ////////////////// \\u2588 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 //////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 \\u2593\\u2593 /////////\\u2593\\u2593\\u2593///////\\u2593\\u2593\\u2593///////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ,////////////////////////////////////// \\u2593\\u2593 \\u2593\\u2593 \\n \\u2593\\u2593 ////////////////////////////////////////// \\u2593\\u2593 \\n \\u2593\\u2593 //////////////////////\\u2593\\u2593\\u2593\\u2593///////////////////// \\n ,//////////////////////////////////////////////////// \\n .////////////////////////////////////////////////////////// \\n .//////////////////////////\\u2588\\u2588.,//////////////////////////\\u2588 \\n .//////////////////////\\u2588\\u2588\\u2588\\u2588..,./////////////////////\\u2588\\u2588 \\n ...////////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588.....,.////////////////\\u2588\\u2588\\u2588 \\n ,.,////////////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........,///////////\\u2588\\u2588\\u2588\\u2588 \\n .,.,//////\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ,.......///////\\u2588\\u2588\\u2588\\u2588 \\n ,..//\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 ........./\\u2588\\u2588\\u2588\\u2588 \\n ..,\\u2588\\u2588\\u2588\\u2588\\u2588\\u2588 .....,\\u2588\\u2588\\u2588 \\n .\\u2588\\u2588 ,.,\\u2588 \\n \\n \\n \\n \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593 \\n \\u2593\\u2593\\u2593 \\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593\\u2593 \\n*/\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\\\";\\nimport \\\"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\\\";\\nimport \\\"@openzeppelin/contracts/interfaces/IERC4626.sol\\\";\\n\\nimport \\\"./interfaces/external/uniswap/IUniswapRouter.sol\\\";\\nimport \\\"./interfaces/external/IWETH9.sol\\\";\\nimport \\\"./interfaces/ICoreBorrow.sol\\\";\\nimport \\\"./interfaces/IDepositWithReferral.sol\\\";\\nimport \\\"./interfaces/ILiquidityGauge.sol\\\";\\nimport \\\"./interfaces/ISwapper.sol\\\";\\nimport \\\"./interfaces/IVaultManager.sol\\\";\\n\\n// ============================== STRUCTS AND ENUM =============================\\n\\n/// @notice Action types\\nenum ActionType {\\n transfer,\\n wrapNative,\\n unwrapNative,\\n sweep,\\n sweepNative,\\n // Deprecated\\n uniswapV3,\\n oneInch,\\n claimRewards,\\n // Deprecated\\n gaugeDeposit,\\n borrower,\\n swapper,\\n mint4626,\\n deposit4626,\\n redeem4626,\\n withdraw4626,\\n // Deprecated\\n prepareRedeemSavingsRate,\\n // Deprecated\\n claimRedeemSavingsRate,\\n // Deprecated\\n swapIn,\\n // Deprecated\\n swapOut,\\n claimWeeklyInterest,\\n // Deprecated\\n withdraw,\\n // Deprecated\\n mint,\\n // Deprecated\\n deposit,\\n // Deprecated\\n openPerpetual,\\n // Deprecated\\n addToPerpetual,\\n veANGLEDeposit,\\n // Deprecated\\n claimRewardsWithPerps,\\n deposit4626Referral\\n}\\n\\n/// @notice Data needed to get permits\\nstruct PermitType {\\n address token;\\n address owner;\\n uint256 value;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @notice Data to grant permit to the router for a vault\\nstruct PermitVaultManagerType {\\n address vaultManager;\\n address owner;\\n bool approved;\\n uint256 deadline;\\n uint8 v;\\n bytes32 r;\\n bytes32 s;\\n}\\n\\n/// @title BaseRouter\\n/// @author Angle Core Team\\n/// @notice Base contract that Angle router contracts on different chains should override\\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\\n using SafeERC20 for IERC20;\\n\\n // ================================= REFERENCES ================================\\n\\n /// @notice Core address handling access control\\n ICoreBorrow public core;\\n /// @notice Address of the router used for swaps\\n IUniswapV3Router public uniswapV3Router;\\n /// @notice Address of 1Inch router used for swaps\\n address public oneInch;\\n\\n uint256[47] private __gap;\\n\\n // ============================== EVENTS / ERRORS ==============================\\n\\n error IncompatibleLengths();\\n error InvalidReturnMessage();\\n error NotApprovedOrOwner();\\n error NotGovernor();\\n error NotGovernorOrGuardian();\\n error TooSmallAmountOut();\\n error TransferFailed();\\n error ZeroAddress();\\n\\n event ReferredDeposit(\\n address caller,\\n address indexed owner,\\n uint256 assets,\\n uint256 shares,\\n address indexed savings,\\n address indexed referrer\\n );\\n\\n /// @notice Deploys the router contract on a chain\\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\\n if (_core == address(0)) revert ZeroAddress();\\n core = ICoreBorrow(_core);\\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\\n oneInch = _oneInch;\\n }\\n\\n constructor() initializer {}\\n\\n // =========================== ROUTER FUNCTIONALITIES ==========================\\n\\n /// @notice Allows composable calls to different functions within the protocol\\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\\n /// @param actions List of actions to be performed by the router (in order of execution)\\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\\n /// for a given action are stored\\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\\n /// do not perform a sweep action on these tokens\\n function mixer(\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) public payable virtual {\\n // If all tokens have already been approved, there's no need for this step\\n uint256 permitsLength = paramsPermit.length;\\n for (uint256 i; i < permitsLength; ++i) {\\n IERC20Permit(paramsPermit[i].token).permit(\\n paramsPermit[i].owner,\\n address(this),\\n paramsPermit[i].value,\\n paramsPermit[i].deadline,\\n paramsPermit[i].v,\\n paramsPermit[i].r,\\n paramsPermit[i].s\\n );\\n }\\n // Performing actions one after the others\\n uint256 actionsLength = actions.length;\\n for (uint256 i; i < actionsLength; ++i) {\\n if (actions[i] == ActionType.transfer) {\\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\\n } else if (actions[i] == ActionType.wrapNative) {\\n _wrapNative();\\n } else if (actions[i] == ActionType.unwrapNative) {\\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\\n _unwrapNative(minAmountOut, to);\\n } else if (actions[i] == ActionType.sweep) {\\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\\n _sweep(tokenOut, minAmountOut, to);\\n } else if (actions[i] == ActionType.sweepNative) {\\n uint256 routerBalance = address(this).balance;\\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\\n } else if (actions[i] == ActionType.oneInch) {\\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\\n data[i],\\n (address, uint256, bytes)\\n );\\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\\n } else if (actions[i] == ActionType.claimRewards) {\\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\\n _claimRewards(user, claimLiquidityGauges);\\n } else if (actions[i] == ActionType.borrower) {\\n (\\n address collateral,\\n address vaultManager,\\n address to,\\n address who,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n bytes memory repayData\\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\\n } else if (actions[i] == ActionType.swapper) {\\n (\\n ISwapper swapperContract,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory payload\\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\\n } else if (actions[i] == ActionType.mint4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _mint4626(savingsRate, shares, to, maxAmountIn);\\n } else if (actions[i] == ActionType.deposit4626) {\\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\\n data[i],\\n (IERC20, IERC4626, uint256, address, uint256)\\n );\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626(savingsRate, amount, to, minSharesOut);\\n } else if (actions[i] == ActionType.deposit4626Referral) {\\n (\\n IERC20 token,\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\\n _changeAllowance(token, address(savingsRate), type(uint256).max);\\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\\n } else if (actions[i] == ActionType.redeem4626) {\\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _redeem4626(savingsRate, shares, to, minAmountOut);\\n } else if (actions[i] == ActionType.withdraw4626) {\\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\\n data[i],\\n (IERC4626, uint256, address, uint256)\\n );\\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\\n } else {\\n _chainSpecificAction(actions[i], data[i]);\\n }\\n }\\n }\\n\\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\\n /// addresses depositing from a certain referring address into an ERC4626 contract\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut) {\\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\\n _changeAllowance(IERC20(token), savings, type(uint256).max);\\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\\n }\\n\\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\\n /// actions and then revoking this approval after these actions\\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\\n /// to revoke approvals\\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\\n /// is just an option\\n function mixerVaultManagerPermit(\\n PermitVaultManagerType[] memory paramsPermitVaultManager,\\n PermitType[] memory paramsPermit,\\n ActionType[] calldata actions,\\n bytes[] calldata data\\n ) external payable virtual {\\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n true,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n } else break;\\n }\\n mixer(paramsPermit, actions, data);\\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\\n // too deep\\n for (uint256 i; i < permitVaultManagerLength; ++i) {\\n if (!paramsPermitVaultManager[i].approved) {\\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\\n paramsPermitVaultManager[i].owner,\\n address(this),\\n false,\\n paramsPermitVaultManager[i].deadline,\\n paramsPermitVaultManager[i].v,\\n paramsPermitVaultManager[i].r,\\n paramsPermitVaultManager[i].s\\n );\\n }\\n }\\n }\\n\\n receive() external payable {}\\n\\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\\n\\n /// @notice Wraps the native token of a chain to its wrapped version\\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\\n /// @dev The amount to wrap is to be specified in the `msg.value`\\n function _wrapNative() internal virtual returns (uint256) {\\n _getNativeWrapper().deposit{ value: msg.value }();\\n return msg.value;\\n }\\n\\n /// @notice Unwraps the wrapped version of a token to the native chain token\\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\\n amount = _getNativeWrapper().balanceOf(address(this));\\n _slippageCheck(amount, minAmountOut);\\n if (amount != 0) {\\n _getNativeWrapper().withdraw(amount);\\n _safeTransferNative(to, amount);\\n }\\n return amount;\\n }\\n\\n /// @notice Internal version of the `claimRewards` function\\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\\n uint256 gaugesLength = liquidityGauges.length;\\n for (uint256 i; i < gaugesLength; ++i) {\\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\\n }\\n }\\n\\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\\n /// @param vaultManager Address of the vault to perform actions on\\n /// @param actionsBorrow Actions type to perform on the vaultManager\\n /// @param dataBorrow Data needed for each actions\\n /// @param to Address to send the funds to\\n /// @param who Swapper address to handle repayments\\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\\n function _angleBorrower(\\n address vaultManager,\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address to,\\n address who,\\n bytes memory repayData\\n ) internal virtual returns (PaymentData memory paymentData) {\\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\\n }\\n\\n /// @notice Sweeps tokens from the router contract\\n /// @param tokenOut Token to sweep\\n /// @param minAmountOut Minimum amount of tokens to recover\\n /// @param to Address to which tokens should be sent\\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\\n _slippageCheck(balanceToken, minAmountOut);\\n if (balanceToken != 0) {\\n IERC20(tokenOut).safeTransfer(to, balanceToken);\\n }\\n }\\n\\n /// @notice Uses an external swapper\\n /// @param swapper Contracts implementing the logic of the swap\\n /// @param inToken Token used to do the swap\\n /// @param outToken Token wanted\\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\\n /// @param inTokenObtained Amount of `inToken` used for the swap\\n /// @param data Additional info for the specific swapper\\n function _swapper(\\n ISwapper swapper,\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) internal {\\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\\n }\\n\\n /// @notice Swaps an inToken to another token via 1Inch Router\\n /// @param payload Bytes needed for 1Inch router to process the swap\\n /// @dev The `payload` given is expected to be obtained from 1Inch API\\n function _swapOn1Inch(\\n IERC20 inToken,\\n uint256 minAmountOut,\\n bytes memory payload\\n ) internal returns (uint256 amountOut) {\\n // Approve transfer to the `oneInch` address\\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\\n address oneInchRouter = oneInch;\\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\\n //solhint-disable-next-line\\n (bool success, bytes memory result) = oneInchRouter.call(payload);\\n if (!success) _revertBytes(result);\\n\\n amountOut = abi.decode(result, (uint256));\\n _slippageCheck(amountOut, minAmountOut);\\n }\\n\\n /// @notice Mints `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to mint shares from\\n /// @param shares Amount of shares to mint from the contract\\n /// @param to Address to which shares should be sent\\n /// @param maxAmountIn Max amount of assets used to mint\\n /// @return amountIn Amount of assets used to mint by `to`\\n function _mint4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 maxAmountIn\\n ) internal returns (uint256 amountIn) {\\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\\n }\\n\\n /// @notice Deposits `amount` to an ERC4626 contract\\n /// @param savingsRate The ERC4626 to deposit assets to\\n /// @param amount Amount of assets to deposit\\n /// @param to Address to which shares should be sent\\n /// @param minSharesOut Minimum amount of shares that `to` should received\\n /// @return sharesOut Amount of shares received by `to`\\n function _deposit4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\\n }\\n\\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\\n function _deposit4626Referral(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) internal returns (uint256 sharesOut) {\\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\\n }\\n\\n /// @notice Withdraws `amount` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to withdraw assets from\\n /// @param amount Amount of assets to withdraw\\n /// @param to Destination of assets\\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\\n /// @return sharesOut Amount of shares burnt\\n function _withdraw4626(\\n IERC4626 savingsRate,\\n uint256 amount,\\n address to,\\n uint256 maxSharesOut\\n ) internal returns (uint256 sharesOut) {\\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\\n }\\n\\n /// @notice Redeems `shares` from an ERC4626 contract\\n /// @param savingsRate ERC4626 to redeem shares from\\n /// @param shares Amount of shares to redeem\\n /// @param to Destination of assets\\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\\n /// @return amountOut Amount of assets received by `to`\\n function _redeem4626(\\n IERC4626 savingsRate,\\n uint256 shares,\\n address to,\\n uint256 minAmountOut\\n ) internal returns (uint256 amountOut) {\\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\\n }\\n\\n /// @notice Allows to perform some specific actions for a chain\\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\\n\\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\\n\\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\\n\\n // ============================ GOVERNANCE FUNCTION ============================\\n\\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\\n modifier onlyGovernorOrGuardian() {\\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\\n _;\\n }\\n\\n /// @notice Sets a new `core` contract\\n function setCore(ICoreBorrow _core) external {\\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\\n core = ICoreBorrow(_core);\\n }\\n\\n /// @notice Changes allowances for different tokens\\n /// @param tokens Addresses of the tokens to allow\\n /// @param spenders Addresses to allow transfer\\n /// @param amounts Amounts to allow\\n function changeAllowance(\\n IERC20[] calldata tokens,\\n address[] calldata spenders,\\n uint256[] calldata amounts\\n ) external onlyGovernorOrGuardian {\\n uint256 tokensLength = tokens.length;\\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\\n for (uint256 i; i < tokensLength; ++i) {\\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\\n }\\n }\\n\\n /// @notice Sets a new router variable\\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\\n if (router == address(0)) revert ZeroAddress();\\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\\n else oneInch = router;\\n }\\n\\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\\n\\n /// @notice Changes allowance of this contract for a given token\\n /// @param token Address of the token to change allowance\\n /// @param spender Address to change the allowance of\\n /// @param amount Amount allowed\\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\\n uint256 currentAllowance = token.allowance(address(this), spender);\\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\\n } else if (currentAllowance > amount) {\\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\\n }\\n }\\n\\n /// @notice Transfer amount of the native token to the `to` address\\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\\n function _safeTransferNative(address to, uint256 amount) internal {\\n bool success;\\n //solhint-disable-next-line\\n assembly {\\n // Transfer the ETH and store if it succeeded or not.\\n success := call(gas(), to, amount, 0, 0, 0, 0)\\n }\\n if (!success) revert TransferFailed();\\n }\\n\\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\\n /// the calling address is well approved for all the vaults with which it is interacting\\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\\n /// with a vault are approved for this vault\\n function _parseVaultIDs(\\n ActionBorrowType[] memory actionsBorrow,\\n bytes[] memory dataBorrow,\\n address vaultManager,\\n address collateral\\n ) internal view returns (bytes[] memory) {\\n uint256 actionsBorrowLength = actionsBorrow.length;\\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\\n bool createVaultAction;\\n uint256 lastVaultID;\\n uint256 vaultIDLength;\\n for (uint256 i; i < actionsBorrowLength; ++i) {\\n uint256 vaultID;\\n // If there is a `createVault` action, the router should not worry about looking at\\n // next vaultIDs given equal to 0\\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\\n createVaultAction = true;\\n continue;\\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\\n // as collateral the full contract balance\\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\\n uint256 amount;\\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\\n if (amount == type(uint256).max)\\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\\n continue;\\n // There are different ways depending on the action to find the `vaultID` to parse\\n } else if (\\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\\n ) {\\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\\n vaultID = abi.decode(dataBorrow[i], (uint256));\\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\\n } else continue;\\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\\n // if there has not been any specific action\\n if (vaultID == 0) {\\n if (createVaultAction) {\\n continue;\\n } else {\\n // If we haven't stored the last `vaultID`, we need to fetch it\\n if (lastVaultID == 0) {\\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\\n }\\n vaultID = lastVaultID;\\n }\\n }\\n\\n // Check if this `vaultID` has already been verified\\n for (uint256 j; j < vaultIDLength; ++j) {\\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\\n // If yes, we continue to the next iteration\\n continue;\\n }\\n }\\n // Verify this new `vaultID` and add it to the list\\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\\n revert NotApprovedOrOwner();\\n }\\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\\n vaultIDLength += 1;\\n }\\n return dataBorrow;\\n }\\n\\n /// @notice Checks whether the amount obtained during a swap is not too small\\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\\n if (amount < thresholdAmount) revert TooSmallAmountOut();\\n }\\n\\n /// @notice Internal function used for error handling\\n function _revertBytes(bytes memory errMsg) internal pure {\\n if (errMsg.length != 0) {\\n //solhint-disable-next-line\\n assembly {\\n revert(add(32, errMsg), mload(errMsg))\\n }\\n }\\n revert InvalidReturnMessage();\\n }\\n}\\n\",\"keccak256\":\"0x5b45e51240ed42ae858c34a0e7e15003885bd998d3a47da7a4fa5604b69f5c2f\",\"license\":\"GPL-3.0\"},\"contracts/implementations/polygon/AngleRouterPolygon.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"../../BaseRouter.sol\\\";\\n\\n/// @title AngleRouterPolygon\\n/// @author Angle Core Team\\n/// @notice Router contract built specifially for Angle use cases on Polygon\\ncontract AngleRouterPolygon is BaseRouter {\\n /// @inheritdoc BaseRouter\\n function _getNativeWrapper() internal pure override returns (IWETH9) {\\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\\n }\\n}\\n\",\"keccak256\":\"0x1ab2be69f4141486e87e825741365300ae251c2ce5ca8db0e5e3b1eb94a722bf\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ICoreBorrow.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ICoreBorrow\\n/// @author Angle Core Team\\n/// @notice Interface for the `CoreBorrow` contract\\n\\ninterface ICoreBorrow {\\n /// @notice Checks whether an address is governor of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\\n function isGovernor(address admin) external view returns (bool);\\n\\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\\n /// @param admin Address to check\\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\\n /// role by calling the `addGovernor` function\\n function isGovernorOrGuardian(address admin) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x2414539c445977b04bc7e9adac2e5147364994dd74e5d7118b44824956de602c\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IDepositWithReferral.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity >=0.5.0;\\n\\n/// @title IDepositWithReferral\\n/// @author Angle Core Team\\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\\ninterface IDepositWithReferral {\\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\\n /// obtained, the function reverts\\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\\n /// when a deposit takes place\\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\\n function deposit4626Referral(\\n address token,\\n address savings,\\n uint256 amount,\\n address to,\\n uint256 minSharesOut,\\n address referrer\\n ) external returns (uint256 sharesOut);\\n}\\n\",\"keccak256\":\"0x69b88fa9ec5111394843f54f312c3b8c1b47490c76109a97ba90e4ac5697e960\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ILiquidityGauge.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\ninterface ILiquidityGauge {\\n // solhint-disable-next-line\\n function staking_token() external returns (address stakingToken);\\n\\n // solhint-disable-next-line\\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\\n\\n function deposit(\\n uint256 _value,\\n address _addr,\\n // solhint-disable-next-line\\n bool _claim_rewards\\n ) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr) external;\\n\\n // solhint-disable-next-line\\n function claim_rewards(address _addr, address _receiver) external;\\n}\\n\",\"keccak256\":\"0x27144c21760603a4e441bb5eecf975ad7f71331ac0ba0a83352b280ccf734756\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ISwapper.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/interfaces/IERC20.sol\\\";\\n\\n/// @title ISwapper\\n/// @author Angle Core Team\\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\\ninterface ISwapper {\\n function swap(\\n IERC20 inToken,\\n IERC20 outToken,\\n address outTokenRecipient,\\n uint256 outTokenOwed,\\n uint256 inTokenObtained,\\n bytes memory data\\n ) external;\\n}\\n\",\"keccak256\":\"0x506f50d8447c2dc662bd844779cc66a407af07a91210612b956ef47abcc15776\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/ITreasury.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\n/// @title ITreasury\\n/// @author Angle Core Team\\n/// @notice Interface for the `Treasury` contract\\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\\n/// of this module\\ninterface ITreasury {\\n /// @notice Checks whether a given address has well been initialized in this contract\\n /// as a `VaultManager``\\n /// @param _vaultManager Address to check\\n /// @return Whether the address has been initialized or not\\n function isVaultManager(address _vaultManager) external view returns (bool);\\n}\\n\",\"keccak256\":\"0x36bd50a0ab1c46503bb64b8d5777bf3b4fd2da0e2dcfe68c8a9702eb132eb3e2\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/IVaultManager.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\nimport \\\"./ITreasury.sol\\\";\\n\\n// ========================= Key Structs and Enums =============================\\n\\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\\n/// to the caller or associated addresses\\nstruct PaymentData {\\n // Stablecoin amount the contract should give\\n uint256 stablecoinAmountToGive;\\n // Stablecoin amount owed to the contract\\n uint256 stablecoinAmountToReceive;\\n // Collateral amount the contract should give\\n uint256 collateralAmountToGive;\\n // Collateral amount owed to the contract\\n uint256 collateralAmountToReceive;\\n}\\n\\n/// @notice Data stored to track someone's loan (or equivalently called position)\\nstruct Vault {\\n // Amount of collateral deposited in the vault\\n uint256 collateralAmount;\\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\\n uint256 normalizedDebt;\\n}\\n\\n/// @notice Actions possible when composing calls to the different entry functions proposed\\nenum ActionBorrowType {\\n createVault,\\n closeVault,\\n addCollateral,\\n removeCollateral,\\n repayDebt,\\n borrow,\\n getDebtIn,\\n permit\\n}\\n\\n// ========================= Interfaces =============================\\n\\n/// @title IVaultManagerFunctions\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface only contains functions of the contract which are called by other contracts\\n/// of this module (without getters)\\ninterface IVaultManagerFunctions {\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\\n /// this function can perform any of the allowed actions in the order of their choice\\n /// @param actions Set of actions to perform\\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\\n /// should either be the `msg.sender` or be approved by the latter\\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\\n /// @param repayData Data to pass to the repayment contract in case of\\n /// @return paymentData Struct containing the final transfers executed\\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\\n /// or computations (like `oracleValue`) are done only once\\n function angle(\\n ActionBorrowType[] memory actions,\\n bytes[] memory datas,\\n address from,\\n address to,\\n address who,\\n bytes memory repayData\\n ) external payable returns (PaymentData memory paymentData);\\n\\n /// @notice Checks whether a given address is approved for a vault or owns this vault\\n /// @param spender Address for which vault ownership should be checked\\n /// @param vaultID ID of the vault to check\\n /// @return Whether the `spender` address owns or is approved for `vaultID`\\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\\n\\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\\n /// @param spender Address to give approval to\\n /// @param approved Whether to give or revoke the approval\\n /// @param deadline Deadline parameter for the signature to be valid\\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\\n function permit(\\n address owner,\\n address spender,\\n bool approved,\\n uint256 deadline,\\n uint8 v,\\n bytes32 r,\\n bytes32 s\\n ) external;\\n}\\n\\n/// @title IVaultManagerStorage\\n/// @author Angle Core Team\\n/// @notice Interface for the `VaultManager` contract\\n/// @dev This interface contains getters of the contract's public variables used by other contracts\\n/// of this module\\ninterface IVaultManagerStorage {\\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\\n function treasury() external view returns (ITreasury);\\n\\n /// @notice Reference to the collateral handled by this `VaultManager`\\n function collateral() external view returns (IERC20);\\n\\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\\n function vaultIDCount() external view returns (uint256);\\n}\\n\",\"keccak256\":\"0x4cf6dc5e5b494165e4d9e524dca5c65f6307e5b005a62287c5e84f1539dc81f1\",\"license\":\"GPL-3.0\"},\"contracts/interfaces/external/IWETH9.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-2.0-or-later\\npragma solidity ^0.8.17;\\n\\nimport \\\"@openzeppelin/contracts/token/ERC20/IERC20.sol\\\";\\n\\n/// @title Interface for WETH9\\ninterface IWETH9 is IERC20 {\\n /// @notice Deposit ether to get wrapped ether\\n function deposit() external payable;\\n\\n /// @notice Withdraw wrapped ether to get ether\\n function withdraw(uint256) external;\\n}\\n\",\"keccak256\":\"0xb109c1d668416c05f61d6edea2ec7a10b2f8b386fd51a59cc12f929c73d00424\",\"license\":\"GPL-2.0-or-later\"},\"contracts/interfaces/external/uniswap/IUniswapRouter.sol\":{\"content\":\"// SPDX-License-Identifier: GPL-3.0\\n\\npragma solidity ^0.8.17;\\n\\nstruct ExactInputParams {\\n bytes path;\\n address recipient;\\n uint256 deadline;\\n uint256 amountIn;\\n uint256 amountOutMinimum;\\n}\\n\\n/// @title Router token swapping functionality\\n/// @notice Functions for swapping tokens via Uniswap V3\\ninterface IUniswapV3Router {\\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\\n /// @return amountOut The amount of the received token\\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\\n}\\n\\n/// @title Router for price estimation functionality\\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\\n/// @dev This interface is only used for non critical elements of the protocol\\ninterface IUniswapV2Router {\\n /// @notice Given an input asset amount, returns the maximum output amount of the\\n /// other asset (accounting for fees) given reserves.\\n /// @param path Addresses of the pools used to get prices\\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\\n\\n function swapExactTokensForTokens(\\n uint256 swapAmount,\\n uint256 minExpected,\\n address[] calldata path,\\n address receiver,\\n uint256 swapDeadline\\n ) external;\\n}\\n\",\"keccak256\":\"0x1908fcdc6ff78ad2250f6ccacc7129df464a648cb2a5f376bedbe506d058bb73\",\"license\":\"GPL-3.0\"}},\"version\":1}", + "bytecode": "0x60806040523480156200001157600080fd5b50600054610100900460ff1615808015620000335750600054600160ff909116105b8062000063575062000050306200013d60201b620018d51760201c565b15801562000063575060005460ff166001145b620000cb5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b6000805460ff191660011790558015620000ef576000805461ff0019166101001790555b801562000136576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b506200014c565b6001600160a01b03163b151590565b613f52806200015c6000396000f3fe6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b6000730d500b1d8e8ef31e21c99d1db9a6444d3adf127073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b6000730d500b1d8e8ef31e21c99d1db9a6444d3adf12706040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101829052730d500b1d8e8ef31e21c99d1db9a6444d3adf127090632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea26469706673582212200e8b96634775ffb74ea7aa629ea3cf275de434f8789df9d2b27e574ab5e9166864736f6c63430008110033", + "deployedBytecode": "0x6080604052600436106100b55760003560e01c80638000963011610069578063848c48da1161004e578063848c48da146101e8578063b82c4dc1146101fb578063f2f4eb261461021b57600080fd5b806380009630146101a857806383f1d681146101c857600080fd5b806340c7c4ed1161009a57806340c7c4ed1461014557806342860d4b1461017357806359856d561461019557600080fd5b8063045c08d5146100c15780632c76d7a61461011857600080fd5b366100bc57005b600080fd5b3480156100cd57600080fd5b506002546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561012457600080fd5b506001546100ee9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561015157600080fd5b50610165610160366004612f34565b61024e565b60405190815260200161010f565b34801561017f57600080fd5b5061019361018e366004612fa4565b6102b5565b005b6101936101a3366004613204565b610520565b3480156101b457600080fd5b506101936101c336600461338a565b6108bc565b3480156101d457600080fd5b506101936101e33660046133a7565b610a6e565b6101936101f63660046133dc565b610c1e565b34801561020757600080fd5b50610193610216366004613471565b611737565b34801561022757600080fd5b506000546100ee9062010000900473ffffffffffffffffffffffffffffffffffffffff1681565b600061027273ffffffffffffffffffffffffffffffffffffffff88163330886118f1565b61029d87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6102aa8686868686611b0b565b979650505050505050565b600054610100900460ff16158080156102d55750600054600160ff909116105b806102ef5750303b1580156102ef575060005460ff166001145b610380576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a656400000000000000000000000000000000000060648201526084015b60405180910390fd5b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600117905580156103de57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b73ffffffffffffffffffffffffffffffffffffffff841661042b576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff80871662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff90921691909117909155600180548583167fffffffffffffffffffffffff0000000000000000000000000000000000000000918216179091556002805492851692909116919091179055801561051a57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050565b855160005b818110156106e85787818151811061053f5761053f6134ec565b602002602001015160400151156106d357878181518110610562576105626134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061059b5761059b6134ec565b6020026020010151602001513060018c86815181106105bc576105bc6134ec565b6020026020010151606001518d87815181106105da576105da6134ec565b6020026020010151608001518e88815181106105f8576105f86134ec565b602002602001015160a001518f8981518110610616576106166134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b1580156106b657600080fd5b505af11580156106ca573d6000803e3d6000fd5b505050506106d8565b6106e8565b6106e18161354a565b9050610525565b506106f68686868686610c1e565b60005b818110156108b257878181518110610713576107136134ec565b6020026020010151604001516108a257878181518110610735576107356134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663f51cc7dd89838151811061076e5761076e6134ec565b6020026020010151602001513060008c868151811061078f5761078f6134ec565b6020026020010151606001518d87815181106107ad576107ad6134ec565b6020026020010151608001518e88815181106107cb576107cb6134ec565b602002602001015160a001518f89815181106107e9576107e96134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701529215156044860152606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b15801561088957600080fd5b505af115801561089d573d6000803e3d6000fd5b505050505b6108ab8161354a565b90506106f9565b5050505050505050565b6000546040517fe43581b80000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063e43581b890602401602060405180830381865afa15801561092f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109539190613582565b15806109ea57506040517fe43581b800000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff82169063e43581b890602401602060405180830381865afa1580156109c4573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109e89190613582565b155b15610a21576040517fee3675d400000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000805473ffffffffffffffffffffffffffffffffffffffff90921662010000027fffffffffffffffffffff0000000000000000000000000000000000000000ffff909216919091179055565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa158015610ae1573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b059190613582565b610b3b576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8216610b88576040517fd92e233d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8060ff16600003610bd9576001805473ffffffffffffffffffffffffffffffffffffffff84167fffffffffffffffffffffffff00000000000000000000000000000000000000009091161790555050565b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff84161790555b5050565b845160005b81811015610dd657868181518110610c3d57610c3d6134ec565b60200260200101516000015173ffffffffffffffffffffffffffffffffffffffff1663d505accf888381518110610c7657610c766134ec565b602002602001015160200151308a8581518110610c9557610c956134ec565b6020026020010151604001518b8681518110610cb357610cb36134ec565b6020026020010151606001518c8781518110610cd157610cd16134ec565b6020026020010151608001518d8881518110610cef57610cef6134ec565b602002602001015160a001518e8981518110610d0d57610d0d6134ec565b602090810291909101015160c001516040517fffffffff0000000000000000000000000000000000000000000000000000000060e08a901b16815273ffffffffffffffffffffffffffffffffffffffff97881660048201529690951660248701526044860193909352606485019190915260ff16608484015260a483015260c482015260e401600060405180830381600087803b158015610dad57600080fd5b505af1158015610dc1573d6000803e3d6000fd5b5050505080610dcf9061354a565b9050610c23565b508360005b818110156108b2576000878783818110610df757610df76134ec565b9050602002016020810190610e0c91906135ce565b601b811115610e1d57610e1d61359f565b03610f40576000806000878785818110610e3957610e396134ec565b9050602002810190610e4b91906135ef565b810190610e58919061365f565b9250925092507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8103610f16576040517f70a0823100000000000000000000000000000000000000000000000000000000815233600482015273ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610eef573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f1391906136a0565b90505b610f3873ffffffffffffffffffffffffffffffffffffffff84163384846118f1565b505050611727565b6001878783818110610f5457610f546134ec565b9050602002016020810190610f6991906135ce565b601b811115610f7a57610f7a61359f565b03610f8d57610f87611b86565b50611727565b6002878783818110610fa157610fa16134ec565b9050602002016020810190610fb691906135ce565b601b811115610fc757610fc761359f565b0361100e57600080868684818110610fe157610fe16134ec565b9050602002810190610ff391906135ef565b81019061100091906136b9565b91509150610f388282611c03565b6003878783818110611022576110226134ec565b905060200201602081019061103791906135ce565b601b8111156110485761104861359f565b03611094576000806000878785818110611064576110646134ec565b905060200281019061107691906135ef565b81019061108391906136e9565b925092509250610f38838383611d4a565b60048787838181106110a8576110a86134ec565b90506020020160208101906110bd91906135ce565b601b8111156110ce576110ce61359f565b036110e457478015610f8757610f873382611e0e565b60068787838181106110f8576110f86134ec565b905060200201602081019061110d91906135ce565b601b81111561111e5761111e61359f565b0361117357600080600087878581811061113a5761113a6134ec565b905060200281019061114c91906135ef565b81019061115991906137ae565b92509250925061116a838383611e53565b50505050611727565b6007878783818110611187576111876134ec565b905060200201602081019061119c91906135ce565b601b8111156111ad576111ad61359f565b036111fb576000808686848181106111c7576111c76134ec565b90506020028101906111d991906135ef565b8101906111e69190613807565b915091506111f48282611f41565b5050611727565b600987878381811061120f5761120f6134ec565b905060200201602081019061122491906135ce565b601b8111156112355761123561359f565b036112d85760008060008060008060008b8b89818110611257576112576134ec565b905060200281019061126991906135ef565b81019061127691906139aa565b96509650965096509650965096506112908383888a611ffe565b91506112bd87877fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6112cb86848488888661252b565b5050505050505050611727565b600a8787838181106112ec576112ec6134ec565b905060200201602081019061130191906135ce565b601b8111156113125761131261359f565b0361137c5760008060008060008060008b8b89818110611334576113346134ec565b905060200281019061134691906135ef565b8101906113539190613a79565b9650965096509650965096509650611370878787878787876125f5565b50505050505050611727565b600b878783818110611390576113906134ec565b90506020020160208101906113a591906135ce565b601b8111156113b6576113b661359f565b036114405760008060008060008989878181106113d5576113d56134ec565b90506020028101906113e791906135ef565b8101906113f49190613b05565b9450945094509450945061142985857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6114358484848461268c565b505050505050611727565b600c878783818110611454576114546134ec565b905060200201602081019061146991906135ce565b601b81111561147a5761147a61359f565b036114f9576000806000806000898987818110611499576114996134ec565b90506020028101906114ab91906135ef565b8101906114b89190613b05565b945094509450945094506114ed85857fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b61143584848484612738565b601b87878381811061150d5761150d6134ec565b905060200201602081019061152291906135ce565b601b8111156115335761153361359f565b036115b6576000806000806000808a8a88818110611553576115536134ec565b905060200281019061156591906135ef565b8101906115729190612f34565b9550955095509550955095506115a986867fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6113708585858585611b0b565b600d8787838181106115ca576115ca6134ec565b90506020020160208101906115df91906135ce565b601b8111156115f0576115f061359f565b0361164a5760008060008088888681811061160d5761160d6134ec565b905060200281019061161f91906135ef565b81019061162c9190613b60565b9350935093509350611640848484846127e2565b5050505050611727565b600e87878381811061165e5761165e6134ec565b905060200201602081019061167391906135ce565b601b8111156116845761168461359f565b036116d4576000806000808888868181106116a1576116a16134ec565b90506020028101906116b391906135ef565b8101906116c09190613b60565b93509350935093506116408484848461284a565b6117278787838181106116e9576116e96134ec565b90506020020160208101906116fe91906135ce565b868684818110611710576117106134ec565b905060200281019061172291906135ef565b505050565b6117308161354a565b9050610ddb565b6000546040517f521d4de90000000000000000000000000000000000000000000000000000000081523360048201526201000090910473ffffffffffffffffffffffffffffffffffffffff169063521d4de990602401602060405180830381865afa1580156117aa573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117ce9190613582565b611804576040517f99e120bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8483811415806118145750808214155b1561184b576040517f46282e8d00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156108b2576118c588888381811061186b5761186b6134ec565b9050602002016020810190611880919061338a565b878784818110611892576118926134ec565b90506020020160208101906118a7919061338a565b8686858181106118b9576118b96134ec565b905060200201356119cd565b6118ce8161354a565b905061184e565b73ffffffffffffffffffffffffffffffffffffffff163b151590565b60405173ffffffffffffffffffffffffffffffffffffffff8085166024830152831660448201526064810182905261051a9085907f23b872dd00000000000000000000000000000000000000000000000000000000906084015b604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe08184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526128b5565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015611a43573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611a6791906136a0565b90508181108015611aa15750611a9e60027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff613ba8565b81105b15611ad757611ad283611ab48385613be3565b73ffffffffffffffffffffffffffffffffffffffff871691906129c1565b61051a565b8181111561051a5761051a83611aed8484613be3565b73ffffffffffffffffffffffffffffffffffffffff87169190612abf565b6000611b1986868686612738565b604080513381526020810188905290810182905290915073ffffffffffffffffffffffffffffffffffffffff80841691888216918716907ff0abe475665c1088274490f21db8d3d3351d565d49d5222cc54656fba17f49119060600160405180910390a495945050505050565b6000730d500b1d8e8ef31e21c99d1db9a6444d3adf127073ffffffffffffffffffffffffffffffffffffffff1663d0e30db0346040518263ffffffff1660e01b81526004016000604051808303818588803b158015611be457600080fd5b505af1158015611bf8573d6000803e3d6000fd5b505050505034905090565b6000730d500b1d8e8ef31e21c99d1db9a6444d3adf12706040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015611c86573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611caa91906136a0565b9050611cb68184612c4c565b8015611d44576040517f2e1a7d4d00000000000000000000000000000000000000000000000000000000815260048101829052730d500b1d8e8ef31e21c99d1db9a6444d3adf127090632e1a7d4d90602401600060405180830381600087803b158015611d2257600080fd5b505af1158015611d36573d6000803e3d6000fd5b50505050611d448282611e0e565b92915050565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015260009073ffffffffffffffffffffffffffffffffffffffff8516906370a0823190602401602060405180830381865afa158015611db7573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611ddb91906136a0565b9050611de78184612c4c565b801561051a5761051a73ffffffffffffffffffffffffffffffffffffffff85168383612c86565b600080600080600085875af1905080611722576040517f90b8ec1800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025460009073ffffffffffffffffffffffffffffffffffffffff16611e9a85827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6119cd565b6000808273ffffffffffffffffffffffffffffffffffffffff1685604051611ec29190613c1a565b6000604051808303816000865af19150503d8060008114611eff576040519150601f19603f3d011682016040523d82523d6000602084013e611f04565b606091505b509150915081611f1757611f1781612cdc565b80806020019051810190611f2b91906136a0565b9350611f378487612c4c565b5050509392505050565b805160005b8181101561051a57828181518110611f6057611f606134ec565b60209081029190910101516040517f84e9bd7e00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8681166004830152909116906384e9bd7e90602401600060405180830381600087803b158015611fd557600080fd5b505af1158015611fe9573d6000803e3d6000fd5b5050505080611ff79061354a565b9050611f46565b835160609060008167ffffffffffffffff81111561201e5761201e612fef565b604051908082528060200260200182016040528015612047578160200160208202803683370190505b5090506000806000805b85811015612519576000808c838151811061206e5761206e6134ec565b602002602001015160078111156120875761208761359f565b03612096576001945050612509565b60028c83815181106120aa576120aa6134ec565b602002602001015160078111156120c3576120c361359f565b036121da5760008b83815181106120dc576120dc6134ec565b60200260200101518060200190518101906120f79190613c36565b9092509050600181016121d3576040517f70a08231000000000000000000000000000000000000000000000000000000008152306004820152829073ffffffffffffffffffffffffffffffffffffffff8c16906370a0823190602401602060405180830381865afa158015612170573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061219491906136a0565b6040805160208101939093528201526060016040516020818303038152906040528c84815181106121c7576121c76134ec565b60200260200101819052505b5050612509565b60038c83815181106121ee576121ee6134ec565b602002602001015160078111156122075761220761359f565b148061223d575060058c8381518110612222576122226134ec565b6020026020010151600781111561223b5761223b61359f565b145b15612277578a8281518110612254576122546134ec565b602002602001015180602001905181019061226f9190613c36565b50905061234e565b60018c838151811061228b5761228b6134ec565b602002602001015160078111156122a4576122a461359f565b036122dd578a82815181106122bb576122bb6134ec565b60200260200101518060200190518101906122d691906136a0565b905061234e565b60068c83815181106122f1576122f16134ec565b6020026020010151600781111561230a5761230a61359f565b03612348578a8281518110612321576123216134ec565b602002602001015180602001905181019061233c9190613c5a565b5091925061234e915050565b50612509565b806000036123df5784156123625750612509565b836000036123dc578973ffffffffffffffffffffffffffffffffffffffff16633c2e941b6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156123b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906123d991906136a0565b93505b50825b60005b8381101561241057818782815181106123fd576123fd6134ec565b5050506124098161354a565b90506123e2565b506040517f430c20810000000000000000000000000000000000000000000000000000000081523360048201526024810182905273ffffffffffffffffffffffffffffffffffffffff8b169063430c208190604401602060405180830381865afa158015612482573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906124a69190613582565b6124dc576040517fe433766c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b808684815181106124ef576124ef6134ec565b6020908102919091010152612505600184613c98565b9250505b6125128161354a565b9050612051565b5088955050505050505b949350505050565b6125566040518060800160405280600081526020016000815260200160008152602001600081525090565b6040517fde8fc69800000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063de8fc698906125b2908990899033908a908a908a90600401613d4a565b6080604051808303816000875af11580156125d1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102aa9190613e4a565b6040517fa5d4096b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff88169063a5d4096b9061265190899089908990899089908990600401613eb0565b600060405180830381600087803b15801561266b57600080fd5b505af115801561267f573d6000803e3d6000fd5b5050505050505050505050565b6040517f94bf804d0000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091612523918491908816906394bf804d906044015b6020604051808303816000875af115801561270c573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061273091906136a0565b925082612c4c565b6040517f6e553f650000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff838116602483015260009161252391871690636e553f65906044015b6020604051808303816000875af11580156127b5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127d991906136a0565b91508183612c4c565b6040517fba0876520000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239187169063ba08765290606401612796565b6040517fb460af940000000000000000000000000000000000000000000000000000000081526004810184905273ffffffffffffffffffffffffffffffffffffffff83811660248301523360448301526000916125239184919088169063b460af94906064016126ed565b6000612917826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c65648152508573ffffffffffffffffffffffffffffffffffffffff16612d1d9092919063ffffffff16565b80519091501561172257808060200190518101906129359190613582565b611722576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610377565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff8381166024830152600091839186169063dd62ed3e90604401602060405180830381865afa158015612a38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612a5c91906136a0565b612a669190613c98565b60405173ffffffffffffffffffffffffffffffffffffffff851660248201526044810182905290915061051a9085907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b6040517fdd62ed3e00000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff83811660248301526000919085169063dd62ed3e90604401602060405180830381865afa158015612b35573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b5991906136a0565b905081811015612beb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602960248201527f5361666545524332303a2064656372656173656420616c6c6f77616e6365206260448201527f656c6f77207a65726f00000000000000000000000000000000000000000000006064820152608401610377565b60405173ffffffffffffffffffffffffffffffffffffffff841660248201528282036044820181905290612c459086907f095ea7b3000000000000000000000000000000000000000000000000000000009060640161194b565b5050505050565b80821015610c1a576040517fa1aabbe100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60405173ffffffffffffffffffffffffffffffffffffffff83166024820152604481018290526117229084907fa9059cbb000000000000000000000000000000000000000000000000000000009060640161194b565b805115612ceb57805181602001fd5b6040517fee418e3700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6060612d2c8484600085612d36565b90505b9392505050565b606082471015612dc8576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c00000000000000000000000000000000000000000000000000006064820152608401610377565b73ffffffffffffffffffffffffffffffffffffffff85163b612e46576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610377565b6000808673ffffffffffffffffffffffffffffffffffffffff168587604051612e6f9190613c1a565b60006040518083038185875af1925050503d8060008114612eac576040519150601f19603f3d011682016040523d82523d6000602084013e612eb1565b606091505b50915091506102aa82828660608315612ecb575081612d2f565b825115612edb5782518084602001fd5b816040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103779190613f09565b73ffffffffffffffffffffffffffffffffffffffff81168114612f3157600080fd5b50565b60008060008060008060c08789031215612f4d57600080fd5b8635612f5881612f0f565b95506020870135612f6881612f0f565b9450604087013593506060870135612f7f81612f0f565b92506080870135915060a0870135612f9681612f0f565b809150509295509295509295565b600080600060608486031215612fb957600080fd5b8335612fc481612f0f565b92506020840135612fd481612f0f565b91506040840135612fe481612f0f565b809150509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160e0810167ffffffffffffffff8111828210171561304157613041612fef565b60405290565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561308e5761308e612fef565b604052919050565b600067ffffffffffffffff8211156130b0576130b0612fef565b5060051b60200190565b8015158114612f3157600080fd5b803560ff811681146130d957600080fd5b919050565b600082601f8301126130ef57600080fd5b813560206131046130ff83613096565b613047565b82815260e0928302850182019282820191908785111561312357600080fd5b8387015b858110156131ab5781818a03121561313f5760008081fd5b61314761301e565b813561315281612f0f565b81528186013561316181612f0f565b81870152604082810135908201526060808301359082015260806131868184016130c8565b9082015260a0828101359082015260c080830135908201528452928401928101613127565b5090979650505050505050565b60008083601f8401126131ca57600080fd5b50813567ffffffffffffffff8111156131e257600080fd5b6020830191508360208260051b85010111156131fd57600080fd5b9250929050565b6000806000806000806080878903121561321d57600080fd5b863567ffffffffffffffff8082111561323557600080fd5b818901915089601f83011261324957600080fd5b813560206132596130ff83613096565b82815260e09092028401810191818101908d84111561327757600080fd5b948201945b8386101561330e5760e0868f0312156132955760008081fd5b61329d61301e565b86356132a881612f0f565b8152868401356132b781612f0f565b818501526040878101356132ca816130ba565b90820152606087810135908201526132e4608088016130c8565b608082015260a0878101359082015260c08088013590820152825260e0909501949082019061327c565b9a50508a01359250508082111561332457600080fd5b6133308a838b016130de565b9650604089013591508082111561334657600080fd5b6133528a838b016131b8565b9096509450606089013591508082111561336b57600080fd5b5061337889828a016131b8565b979a9699509497509295939492505050565b60006020828403121561339c57600080fd5b8135612d2f81612f0f565b600080604083850312156133ba57600080fd5b82356133c581612f0f565b91506133d3602084016130c8565b90509250929050565b6000806000806000606086880312156133f457600080fd5b853567ffffffffffffffff8082111561340c57600080fd5b61341889838a016130de565b9650602088013591508082111561342e57600080fd5b61343a89838a016131b8565b9096509450604088013591508082111561345357600080fd5b50613460888289016131b8565b969995985093965092949392505050565b6000806000806000806060878903121561348a57600080fd5b863567ffffffffffffffff808211156134a257600080fd5b6134ae8a838b016131b8565b909850965060208901359150808211156134c757600080fd5b6134d38a838b016131b8565b9096509450604089013591508082111561336b57600080fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361357b5761357b61351b565b5060010190565b60006020828403121561359457600080fd5b8151612d2f816130ba565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6000602082840312156135e057600080fd5b8135601c8110612d2f57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe184360301811261362457600080fd5b83018035915067ffffffffffffffff82111561363f57600080fd5b6020019150368190038213156131fd57600080fd5b80356130d981612f0f565b60008060006060848603121561367457600080fd5b833561367f81612f0f565b9250602084013561368f81612f0f565b929592945050506040919091013590565b6000602082840312156136b257600080fd5b5051919050565b600080604083850312156136cc57600080fd5b8235915060208301356136de81612f0f565b809150509250929050565b6000806000606084860312156136fe57600080fd5b833561370981612f0f565b9250602084013591506040840135612fe481612f0f565b600082601f83011261373157600080fd5b813567ffffffffffffffff81111561374b5761374b612fef565b61377c60207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f84011601613047565b81815284602083860101111561379157600080fd5b816020850160208301376000918101602001919091529392505050565b6000806000606084860312156137c357600080fd5b83356137ce81612f0f565b925060208401359150604084013567ffffffffffffffff8111156137f157600080fd5b6137fd86828701613720565b9150509250925092565b6000806040838503121561381a57600080fd5b823561382581612f0f565b915060208381013567ffffffffffffffff81111561384257600080fd5b8401601f8101861361385357600080fd5b80356138616130ff82613096565b81815260059190911b8201830190838101908883111561388057600080fd5b928401925b828410156138a757833561389881612f0f565b82529284019290840190613885565b80955050505050509250929050565b600082601f8301126138c757600080fd5b813560206138d76130ff83613096565b82815260059290921b840181019181810190868411156138f657600080fd5b8286015b8481101561391f578035600881106139125760008081fd5b83529183019183016138fa565b509695505050505050565b600082601f83011261393b57600080fd5b8135602061394b6130ff83613096565b82815260059290921b8401810191818101908684111561396a57600080fd5b8286015b8481101561391f57803567ffffffffffffffff81111561398e5760008081fd5b61399c8986838b0101613720565b84525091830191830161396e565b600080600080600080600060e0888a0312156139c557600080fd5b87356139d081612f0f565b965060208801356139e081612f0f565b95506139ee60408901613654565b94506139fc60608901613654565b9350608088013567ffffffffffffffff80821115613a1957600080fd5b613a258b838c016138b6565b945060a08a0135915080821115613a3b57600080fd5b613a478b838c0161392a565b935060c08a0135915080821115613a5d57600080fd5b50613a6a8a828b01613720565b91505092959891949750929550565b600080600080600080600060e0888a031215613a9457600080fd5b8735613a9f81612f0f565b96506020880135613aaf81612f0f565b95506040880135613abf81612f0f565b94506060880135613acf81612f0f565b93506080880135925060a0880135915060c088013567ffffffffffffffff811115613af957600080fd5b613a6a8a828b01613720565b600080600080600060a08688031215613b1d57600080fd5b8535613b2881612f0f565b94506020860135613b3881612f0f565b9350604086013592506060860135613b4f81612f0f565b949793965091946080013592915050565b60008060008060808587031215613b7657600080fd5b8435613b8181612f0f565b9350602085013592506040850135613b9881612f0f565b9396929550929360600135925050565b600082613bde577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b81810381811115611d4457611d4461351b565b60005b83811015613c11578181015183820152602001613bf9565b50506000910152565b60008251613c2c818460208701613bf6565b9190910192915050565b60008060408385031215613c4957600080fd5b505080516020909101519092909150565b60008060008060808587031215613c7057600080fd5b845193506020850151613c8281612f0f565b6040860151606090960151949790965092505050565b80820180821115611d4457611d4461351b565b60008151808452613cc3816020860160208601613bf6565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b600081518084526020808501808196508360051b8101915082860160005b85811015613d3d578284038952613d2b848351613cab565b98850198935090840190600101613d13565b5091979650505050505050565b60c0808252875190820181905260009060209060e0840190828b0184805b83811015613db957825160088110613da7577f4e487b710000000000000000000000000000000000000000000000000000000083526021600452602483fd5b85529385019391850191600101613d68565b5050505083810382850152613dce818a613cf5565b915050613df3604084018873ffffffffffffffffffffffffffffffffffffffff169052565b73ffffffffffffffffffffffffffffffffffffffff8616606084015273ffffffffffffffffffffffffffffffffffffffff8516608084015282810360a0840152613e3d8185613cab565b9998505050505050505050565b600060808284031215613e5c57600080fd5b6040516080810181811067ffffffffffffffff82111715613e7f57613e7f612fef565b8060405250825181526020830151602082015260408301516040820152606083015160608201528091505092915050565b600073ffffffffffffffffffffffffffffffffffffffff8089168352808816602084015280871660408401525084606083015283608083015260c060a0830152613efd60c0830184613cab565b98975050505050505050565b602081526000612d2f6020830184613cab56fea26469706673582212200e8b96634775ffb74ea7aa629ea3cf275de434f8789df9d2b27e574ab5e9166864736f6c63430008110033", + "devdoc": { + "author": "Angle Core Team", + "kind": "dev", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "params": { + "amounts": "Amounts to allow", + "spenders": "Addresses to allow transfer", + "tokens": "Addresses of the tokens to allow" + } + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol does not verify the payload given and cannot check that the swap performed by users actually gives the desired out token: in this case funds may be made accessible to anyone on this contract if the concerned users do not perform a sweep action on these tokens", + "params": { + "actions": "List of actions to be performed by the router (in order of execution)", + "data": "Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters for a given action are stored", + "paramsPermit": "Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract with tokens that do not support permit should approve the contract for these tokens prior to interacting with it" + } + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "details": "In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures to revoke approvalsThe router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this is just an option", + "params": { + "paramsPermitVaultManager": "Parameters to sign permit to give allowance to the router for a `VaultManager` contract" + } + } + }, + "title": "AngleRouterPolygon", + "version": 1 + }, + "userdoc": { + "kind": "user", + "methods": { + "changeAllowance(address[],address[],uint256[])": { + "notice": "Changes allowances for different tokens" + }, + "core()": { + "notice": "Core address handling access control" + }, + "deposit4626Referral(address,address,uint256,address,uint256,address)": { + "notice": "Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track addresses depositing from a certain referring address into an ERC4626 contract" + }, + "initializeRouter(address,address,address)": { + "notice": "Deploys the router contract on a chain" + }, + "mixer((address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Allows composable calls to different functions within the protocol" + }, + "mixerVaultManagerPermit((address,address,bool,uint256,uint8,bytes32,bytes32)[],(address,address,uint256,uint256,uint8,bytes32,bytes32)[],uint8[],bytes[])": { + "notice": "Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing actions and then revoking this approval after these actions" + }, + "oneInch()": { + "notice": "Address of 1Inch router used for swaps" + }, + "setCore(address)": { + "notice": "Sets a new `core` contract" + }, + "setRouter(address,uint8)": { + "notice": "Sets a new router variable" + }, + "uniswapV3Router()": { + "notice": "Address of the router used for swaps" + } + }, + "notice": "Router contract built specifially for Angle use cases on Polygon", + "version": 1 + }, + "storageLayout": { + "storage": [ + { + "astId": 6, + "contract": "contracts/implementations/polygon/AngleRouterPolygon.sol:AngleRouterPolygon", + "label": "_initialized", + "offset": 0, + "slot": "0", + "type": "t_uint8" + }, + { + "astId": 9, + "contract": "contracts/implementations/polygon/AngleRouterPolygon.sol:AngleRouterPolygon", + "label": "_initializing", + "offset": 1, + "slot": "0", + "type": "t_bool" + }, + { + "astId": 1478, + "contract": "contracts/implementations/polygon/AngleRouterPolygon.sol:AngleRouterPolygon", + "label": "core", + "offset": 2, + "slot": "0", + "type": "t_contract(ICoreBorrow)3793" + }, + { + "astId": 1482, + "contract": "contracts/implementations/polygon/AngleRouterPolygon.sol:AngleRouterPolygon", + "label": "uniswapV3Router", + "offset": 0, + "slot": "1", + "type": "t_contract(IUniswapV3Router)4262" + }, + { + "astId": 1485, + "contract": "contracts/implementations/polygon/AngleRouterPolygon.sol:AngleRouterPolygon", + "label": "oneInch", + "offset": 0, + "slot": "2", + "type": "t_address" + }, + { + "astId": 1489, + "contract": "contracts/implementations/polygon/AngleRouterPolygon.sol:AngleRouterPolygon", + "label": "__gap", + "offset": 0, + "slot": "3", + "type": "t_array(t_uint256)47_storage" + } + ], + "types": { + "t_address": { + "encoding": "inplace", + "label": "address", + "numberOfBytes": "20" + }, + "t_array(t_uint256)47_storage": { + "base": "t_uint256", + "encoding": "inplace", + "label": "uint256[47]", + "numberOfBytes": "1504" + }, + "t_bool": { + "encoding": "inplace", + "label": "bool", + "numberOfBytes": "1" + }, + "t_contract(ICoreBorrow)3793": { + "encoding": "inplace", + "label": "contract ICoreBorrow", + "numberOfBytes": "20" + }, + "t_contract(IUniswapV3Router)4262": { + "encoding": "inplace", + "label": "contract IUniswapV3Router", + "numberOfBytes": "20" + }, + "t_uint256": { + "encoding": "inplace", + "label": "uint256", + "numberOfBytes": "32" + }, + "t_uint8": { + "encoding": "inplace", + "label": "uint8", + "numberOfBytes": "1" + } + } + } +} \ No newline at end of file diff --git a/deployments/polygon/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json b/deployments/polygon/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json new file mode 100644 index 0000000..c75418b --- /dev/null +++ b/deployments/polygon/solcInputs/0d1b1c94fd2e1964436c8b9a0e25c545.json @@ -0,0 +1,142 @@ +{ + "language": "Solidity", + "sources": { + "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.2;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be\n * reused. This mechanism prevents re-execution of each \"step\" but allows the creation of new initialization steps in\n * case an upgrade adds a module that needs to be initialized.\n *\n * For example:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * contract MyToken is ERC20Upgradeable {\n * function initialize() initializer public {\n * __ERC20_init(\"MyToken\", \"MTK\");\n * }\n * }\n * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {\n * function initializeV2() reinitializer(2) public {\n * __ERC20Permit_init(\"MyToken\");\n * }\n * }\n * ```\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke\n * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() {\n * _disableInitializers();\n * }\n * ```\n * ====\n */\nabstract contract Initializable {\n /**\n * @dev Indicates that the contract has been initialized.\n * @custom:oz-retyped-from bool\n */\n uint8 private _initialized;\n\n /**\n * @dev Indicates that the contract is in the process of being initialized.\n */\n bool private _initializing;\n\n /**\n * @dev Triggered when the contract has been initialized or reinitialized.\n */\n event Initialized(uint8 version);\n\n /**\n * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,\n * `onlyInitializing` functions can be used to initialize parent contracts. Equivalent to `reinitializer(1)`.\n */\n modifier initializer() {\n bool isTopLevelCall = !_initializing;\n require(\n (isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),\n \"Initializable: contract is already initialized\"\n );\n _initialized = 1;\n if (isTopLevelCall) {\n _initializing = true;\n }\n _;\n if (isTopLevelCall) {\n _initializing = false;\n emit Initialized(1);\n }\n }\n\n /**\n * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the\n * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be\n * used to initialize parent contracts.\n *\n * `initializer` is equivalent to `reinitializer(1)`, so a reinitializer may be used after the original\n * initialization step. This is essential to configure modules that are added through upgrades and that require\n * initialization.\n *\n * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in\n * a contract, executing them in the right order is up to the developer or operator.\n */\n modifier reinitializer(uint8 version) {\n require(!_initializing && _initialized < version, \"Initializable: contract is already initialized\");\n _initialized = version;\n _initializing = true;\n _;\n _initializing = false;\n emit Initialized(version);\n }\n\n /**\n * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n * {initializer} and {reinitializer} modifiers, directly or indirectly.\n */\n modifier onlyInitializing() {\n require(_initializing, \"Initializable: contract is not initializing\");\n _;\n }\n\n /**\n * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.\n * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized\n * to any version. It is recommended to use this to lock implementation contracts that are designed to be called\n * through proxies.\n */\n function _disableInitializers() internal virtual {\n require(!_initializing, \"Initializable: contract is initializing\");\n if (_initialized < type(uint8).max) {\n _initialized = type(uint8).max;\n emit Initialized(type(uint8).max);\n }\n }\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20PermitUpgradeable {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20Upgradeable {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n /**\n * @dev Returns true if `account` is a contract.\n *\n * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "@openzeppelin/contracts/interfaces/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (interfaces/IERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\n" + }, + "@openzeppelin/contracts/interfaces/IERC4626.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (interfaces/IERC4626.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../token/ERC20/IERC20.sol\";\nimport \"../token/ERC20/extensions/IERC20Metadata.sol\";\n\n/**\n * @dev Interface of the ERC4626 \"Tokenized Vault Standard\", as defined in\n * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].\n *\n * _Available since v4.7._\n */\ninterface IERC4626 is IERC20, IERC20Metadata {\n event Deposit(address indexed caller, address indexed owner, uint256 assets, uint256 shares);\n\n event Withdraw(\n address indexed caller,\n address indexed receiver,\n address indexed owner,\n uint256 assets,\n uint256 shares\n );\n\n /**\n * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.\n *\n * - MUST be an ERC-20 token contract.\n * - MUST NOT revert.\n */\n function asset() external view returns (address assetTokenAddress);\n\n /**\n * @dev Returns the total amount of the underlying asset that is “managed” by Vault.\n *\n * - SHOULD include any compounding that occurs from yield.\n * - MUST be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT revert.\n */\n function totalAssets() external view returns (uint256 totalManagedAssets);\n\n /**\n * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToShares(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal\n * scenario where all the conditions are met.\n *\n * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.\n * - MUST NOT show any variations depending on the caller.\n * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.\n * - MUST NOT revert.\n *\n * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the\n * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and\n * from.\n */\n function convertToAssets(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,\n * through a deposit call.\n *\n * - MUST return a limited value if receiver is subject to some deposit limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.\n * - MUST NOT revert.\n */\n function maxDeposit(address receiver) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit\n * call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called\n * in the same transaction.\n * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the\n * deposit would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewDeposit(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * deposit execution, and are accounted for during deposit.\n * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function deposit(uint256 assets, address receiver) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.\n * - MUST return a limited value if receiver is subject to some mint limit.\n * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.\n * - MUST NOT revert.\n */\n function maxMint(address receiver) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given\n * current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call\n * in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the\n * same transaction.\n * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint\n * would be accepted, regardless if the user has enough tokens approved, etc.\n * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by minting.\n */\n function previewMint(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.\n *\n * - MUST emit the Deposit event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint\n * execution, and are accounted for during mint.\n * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not\n * approving enough underlying tokens to the Vault contract, etc).\n *\n * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.\n */\n function mint(uint256 shares, address receiver) external returns (uint256 assets);\n\n /**\n * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the\n * Vault, through a withdraw call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxWithdraw(address owner) external view returns (uint256 maxAssets);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw\n * call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if\n * called\n * in the same transaction.\n * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though\n * the withdrawal would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by depositing.\n */\n function previewWithdraw(uint256 assets) external view returns (uint256 shares);\n\n /**\n * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * withdraw execution, and are accounted for during withdraw.\n * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function withdraw(\n uint256 assets,\n address receiver,\n address owner\n ) external returns (uint256 shares);\n\n /**\n * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,\n * through a redeem call.\n *\n * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.\n * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.\n * - MUST NOT revert.\n */\n function maxRedeem(address owner) external view returns (uint256 maxShares);\n\n /**\n * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,\n * given current on-chain conditions.\n *\n * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call\n * in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the\n * same transaction.\n * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the\n * redemption would be accepted, regardless if the user has enough shares, etc.\n * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.\n * - MUST NOT revert.\n *\n * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in\n * share price or some other type of condition, meaning the depositor will lose assets by redeeming.\n */\n function previewRedeem(uint256 shares) external view returns (uint256 assets);\n\n /**\n * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.\n *\n * - MUST emit the Withdraw event.\n * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the\n * redeem execution, and are accounted for during redeem.\n * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner\n * not having enough shares, etc).\n *\n * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.\n * Those methods should be performed separately.\n */\n function redeem(\n uint256 shares,\n address receiver,\n address owner\n ) external returns (uint256 assets);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-IERC20Permit.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in\n * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].\n *\n * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by\n * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't\n * need to send a transaction, and thus is not required to hold Ether at all.\n */\ninterface IERC20Permit {\n /**\n * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,\n * given ``owner``'s signed approval.\n *\n * IMPORTANT: The same issues {IERC20-approve} has related to transaction\n * ordering also apply here.\n *\n * Emits an {Approval} event.\n *\n * Requirements:\n *\n * - `spender` cannot be the zero address.\n * - `deadline` must be a timestamp in the future.\n * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`\n * over the EIP712-formatted function arguments.\n * - the signature must use ``owner``'s current nonce (see {nonces}).\n *\n * For more information on the signature format, see the\n * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP\n * section].\n */\n function permit(\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n\n /**\n * @dev Returns the current nonce for `owner`. This value must be\n * included whenever a signature is generated for {permit}.\n *\n * Every successful call to {permit} increases ``owner``'s nonce by one. This\n * prevents a signature from being used multiple times.\n */\n function nonces(address owner) external view returns (uint256);\n\n /**\n * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.\n */\n // solhint-disable-next-line func-name-mixedcase\n function DOMAIN_SEPARATOR() external view returns (bytes32);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\n\n/**\n * @dev Interface for the optional metadata functions from the ERC20 standard.\n *\n * _Available since v4.1._\n */\ninterface IERC20Metadata is IERC20 {\n /**\n * @dev Returns the name of the token.\n */\n function name() external view returns (string memory);\n\n /**\n * @dev Returns the symbol of the token.\n */\n function symbol() external view returns (string memory);\n\n /**\n * @dev Returns the decimals places of the token.\n */\n function decimals() external view returns (uint8);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/IERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC20 standard as defined in the EIP.\n */\ninterface IERC20 {\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 /**\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 `to`.\n *\n * Returns a boolean value indicating whether the operation succeeded.\n *\n * Emits a {Transfer} event.\n */\n function transfer(address to, 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 `from` to `to` 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(\n address from,\n address to,\n uint256 amount\n ) external returns (bool);\n}\n" + }, + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../IERC20.sol\";\nimport \"../extensions/draft-IERC20Permit.sol\";\nimport \"../../../utils/Address.sol\";\n\n/**\n * @title SafeERC20\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 IERC20;` statement to your contract,\n * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.\n */\nlibrary SafeERC20 {\n using Address for address;\n\n function safeTransfer(\n IERC20 token,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));\n }\n\n function safeTransferFrom(\n IERC20 token,\n address from,\n address to,\n uint256 value\n ) internal {\n _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));\n }\n\n /**\n * @dev Deprecated. This function has issues similar to the ones found in\n * {IERC20-approve}, and its usage is discouraged.\n *\n * Whenever possible, use {safeIncreaseAllowance} and\n * {safeDecreaseAllowance} instead.\n */\n function safeApprove(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\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 require(\n (value == 0) || (token.allowance(address(this), spender) == 0),\n \"SafeERC20: approve from non-zero to non-zero allowance\"\n );\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));\n }\n\n function safeIncreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n uint256 newAllowance = token.allowance(address(this), spender) + value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n\n function safeDecreaseAllowance(\n IERC20 token,\n address spender,\n uint256 value\n ) internal {\n unchecked {\n uint256 oldAllowance = token.allowance(address(this), spender);\n require(oldAllowance >= value, \"SafeERC20: decreased allowance below zero\");\n uint256 newAllowance = oldAllowance - value;\n _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance));\n }\n }\n\n function safePermit(\n IERC20Permit token,\n address owner,\n address spender,\n uint256 value,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) internal {\n uint256 nonceBefore = token.nonces(owner);\n token.permit(owner, spender, value, deadline, v, r, s);\n uint256 nonceAfter = token.nonces(owner);\n require(nonceAfter == nonceBefore + 1, \"SafeERC20: permit did not succeed\");\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 */\n function _callOptionalReturn(IERC20 token, bytes memory data) private {\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. We use {Address.functionCall} to perform this call, which verifies that\n // the target address contains contract code and also asserts for success in the low-level call.\n\n bytes memory returndata = address(token).functionCall(data, \"SafeERC20: low-level call failed\");\n if (returndata.length > 0) {\n // Return data is optional\n require(abi.decode(returndata, (bool)), \"SafeERC20: ERC20 operation did not succeed\");\n }\n }\n}\n" + }, + "@openzeppelin/contracts/utils/Address.sol": { + "content": "// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.7.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\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 * [IMPORTANT]\n * ====\n * It is unsafe to assume that an address for which this function returns\n * false is an externally-owned account (EOA) and not a contract.\n *\n * Among others, `isContract` will return false for the following\n * types of addresses:\n *\n * - an externally-owned account\n * - a contract in construction\n * - an address where a contract will be created\n * - an address where a contract lived, but was destroyed\n * ====\n *\n * [IMPORTANT]\n * ====\n * You shouldn't rely on `isContract` to protect against flash loan attacks!\n *\n * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n * constructor.\n * ====\n */\n function isContract(address account) internal view returns (bool) {\n // This method relies on extcodesize/address.code.length, which returns 0\n // for contracts in construction, since the code is only stored at the end\n // of the constructor execution.\n\n return account.code.length > 0;\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 function sendValue(address payable recipient, uint256 amount) internal {\n require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n (bool success, ) = recipient.call{value: amount}(\"\");\n require(success, \"Address: unable to send value, recipient may have reverted\");\n }\n\n /**\n * @dev Performs a Solidity function call using a low level `call`. A\n * plain `call` is an unsafe replacement for a function call: use this\n * function instead.\n *\n * If `target` reverts with a revert reason, it is bubbled up by this\n * function (like regular Solidity function calls).\n *\n * Returns the raw returned data. To convert to the expected return value,\n * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n *\n * Requirements:\n *\n * - `target` must be a contract.\n * - calling `target` with `data` must not revert.\n *\n * _Available since v3.1._\n */\n function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionCall(target, data, \"Address: low-level call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n * `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, 0, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but also transferring `value` wei to `target`.\n *\n * Requirements:\n *\n * - the calling contract must have an ETH balance of at least `value`.\n * - the called Solidity function must be `payable`.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value\n ) internal returns (bytes memory) {\n return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n * with `errorMessage` as a fallback revert reason when `target` reverts.\n *\n * _Available since v3.1._\n */\n function functionCallWithValue(\n address target,\n bytes memory data,\n uint256 value,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(address(this).balance >= value, \"Address: insufficient balance for call\");\n require(isContract(target), \"Address: call to non-contract\");\n\n (bool success, bytes memory returndata) = target.call{value: value}(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n return functionStaticCall(target, data, \"Address: low-level static call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a static call.\n *\n * _Available since v3.3._\n */\n function functionStaticCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal view returns (bytes memory) {\n require(isContract(target), \"Address: static call to non-contract\");\n\n (bool success, bytes memory returndata) = target.staticcall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {\n return functionDelegateCall(target, data, \"Address: low-level delegate call failed\");\n }\n\n /**\n * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n * but performing a delegate call.\n *\n * _Available since v3.4._\n */\n function functionDelegateCall(\n address target,\n bytes memory data,\n string memory errorMessage\n ) internal returns (bytes memory) {\n require(isContract(target), \"Address: delegate call to non-contract\");\n\n (bool success, bytes memory returndata) = target.delegatecall(data);\n return verifyCallResult(success, returndata, errorMessage);\n }\n\n /**\n * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n * revert reason using the provided one.\n *\n * _Available since v4.3._\n */\n function verifyCallResult(\n bool success,\n bytes memory returndata,\n string memory errorMessage\n ) internal pure returns (bytes memory) {\n if (success) {\n return returndata;\n } else {\n // Look for revert reason and bubble it up if present\n if (returndata.length > 0) {\n // The easiest way to bubble the revert reason is using memory via assembly\n /// @solidity memory-safe-assembly\n assembly {\n let returndata_size := mload(returndata)\n revert(add(32, returndata), returndata_size)\n }\n } else {\n revert(errorMessage);\n }\n }\n }\n}\n" + }, + "contracts/BaseRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\n/*\n * █ \n ***** ▓▓▓ \n * ▓▓▓▓▓▓▓ \n * ///. ▓▓▓▓▓▓▓▓▓▓▓▓▓ \n ***** //////// ▓▓▓▓▓▓▓ \n * ///////////// ▓▓▓ \n ▓▓ ////////////////// █ ▓▓ \n ▓▓ ▓▓ /////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ //////////////////////////// ▓▓ ▓▓ \n ▓▓ ▓▓ /////////▓▓▓///////▓▓▓///////// ▓▓ ▓▓ \n ▓▓ ,////////////////////////////////////// ▓▓ ▓▓ \n ▓▓ ////////////////////////////////////////// ▓▓ \n ▓▓ //////////////////////▓▓▓▓///////////////////// \n ,//////////////////////////////////////////////////// \n .////////////////////////////////////////////////////////// \n .//////////////////////////██.,//////////////////////////█ \n .//////////////////////████..,./////////////////////██ \n ...////////////////███████.....,.////////////////███ \n ,.,////////////████████ ........,///////////████ \n .,.,//////█████████ ,.......///////████ \n ,..//████████ ........./████ \n ..,██████ .....,███ \n .██ ,.,█ \n \n \n \n ▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓ ▓▓▓▓▓▓▓▓▓▓ \n ▓▓▓▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓ ▓▓▓▓ \n ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓▓ ▓▓ ▓▓▓▓▓ \n ▓▓▓ ▓▓ ▓▓▓ ▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ ▓▓▓▓▓▓▓▓▓▓ \n*/\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/extensions/draft-IERC20Permit.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\nimport \"@openzeppelin/contracts/interfaces/IERC4626.sol\";\n\nimport \"./interfaces/external/uniswap/IUniswapRouter.sol\";\nimport \"./interfaces/external/IWETH9.sol\";\nimport \"./interfaces/ICoreBorrow.sol\";\nimport \"./interfaces/IDepositWithReferral.sol\";\nimport \"./interfaces/ILiquidityGauge.sol\";\nimport \"./interfaces/ISwapper.sol\";\nimport \"./interfaces/IVaultManager.sol\";\n\n// ============================== STRUCTS AND ENUM =============================\n\n/// @notice Action types\nenum ActionType {\n transfer,\n wrapNative,\n unwrapNative,\n sweep,\n sweepNative,\n // Deprecated\n uniswapV3,\n oneInch,\n claimRewards,\n // Deprecated\n gaugeDeposit,\n borrower,\n swapper,\n mint4626,\n deposit4626,\n redeem4626,\n withdraw4626,\n // Deprecated\n prepareRedeemSavingsRate,\n // Deprecated\n claimRedeemSavingsRate,\n // Deprecated\n swapIn,\n // Deprecated\n swapOut,\n claimWeeklyInterest,\n // Deprecated\n withdraw,\n // Deprecated\n mint,\n // Deprecated\n deposit,\n // Deprecated\n openPerpetual,\n // Deprecated\n addToPerpetual,\n veANGLEDeposit,\n // Deprecated\n claimRewardsWithPerps,\n deposit4626Referral\n}\n\n/// @notice Data needed to get permits\nstruct PermitType {\n address token;\n address owner;\n uint256 value;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @notice Data to grant permit to the router for a vault\nstruct PermitVaultManagerType {\n address vaultManager;\n address owner;\n bool approved;\n uint256 deadline;\n uint8 v;\n bytes32 r;\n bytes32 s;\n}\n\n/// @title BaseRouter\n/// @author Angle Core Team\n/// @notice Base contract that Angle router contracts on different chains should override\n/// @dev Router contracts are designed to facilitate the composition of actions on the different modules of the protocol\nabstract contract BaseRouter is Initializable, IDepositWithReferral {\n using SafeERC20 for IERC20;\n\n // ================================= REFERENCES ================================\n\n /// @notice Core address handling access control\n ICoreBorrow public core;\n /// @notice Address of the router used for swaps\n IUniswapV3Router public uniswapV3Router;\n /// @notice Address of 1Inch router used for swaps\n address public oneInch;\n\n uint256[47] private __gap;\n\n // ============================== EVENTS / ERRORS ==============================\n\n error IncompatibleLengths();\n error InvalidReturnMessage();\n error NotApprovedOrOwner();\n error NotGovernor();\n error NotGovernorOrGuardian();\n error TooSmallAmountOut();\n error TransferFailed();\n error ZeroAddress();\n\n event ReferredDeposit(\n address caller,\n address indexed owner,\n uint256 assets,\n uint256 shares,\n address indexed savings,\n address indexed referrer\n );\n\n /// @notice Deploys the router contract on a chain\n function initializeRouter(address _core, address _uniswapRouter, address _oneInch) public initializer {\n if (_core == address(0)) revert ZeroAddress();\n core = ICoreBorrow(_core);\n uniswapV3Router = IUniswapV3Router(_uniswapRouter);\n oneInch = _oneInch;\n }\n\n constructor() initializer {}\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @notice Allows composable calls to different functions within the protocol\n /// @param paramsPermit Array of params `PermitType` used to do a 1 tx to approve the router on each token (can be done once by\n /// setting high approved amounts) which supports the `permit` standard. Users willing to interact with the contract\n /// with tokens that do not support permit should approve the contract for these tokens prior to interacting with it\n /// @param actions List of actions to be performed by the router (in order of execution)\n /// @param data Array of encoded data for each of the actions performed in this mixer. This is where the bytes-encoded parameters\n /// for a given action are stored\n /// @dev With this function, users can specify paths to swap tokens to the desired token of their choice. Yet the protocol\n /// does not verify the payload given and cannot check that the swap performed by users actually gives the desired\n /// out token: in this case funds may be made accessible to anyone on this contract if the concerned users\n /// do not perform a sweep action on these tokens\n function mixer(\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) public payable virtual {\n // If all tokens have already been approved, there's no need for this step\n uint256 permitsLength = paramsPermit.length;\n for (uint256 i; i < permitsLength; ++i) {\n IERC20Permit(paramsPermit[i].token).permit(\n paramsPermit[i].owner,\n address(this),\n paramsPermit[i].value,\n paramsPermit[i].deadline,\n paramsPermit[i].v,\n paramsPermit[i].r,\n paramsPermit[i].s\n );\n }\n // Performing actions one after the others\n uint256 actionsLength = actions.length;\n for (uint256 i; i < actionsLength; ++i) {\n if (actions[i] == ActionType.transfer) {\n (address inToken, address receiver, uint256 amount) = abi.decode(data[i], (address, address, uint256));\n if (amount == type(uint256).max) amount = IERC20(inToken).balanceOf(msg.sender);\n IERC20(inToken).safeTransferFrom(msg.sender, receiver, amount);\n } else if (actions[i] == ActionType.wrapNative) {\n _wrapNative();\n } else if (actions[i] == ActionType.unwrapNative) {\n (uint256 minAmountOut, address to) = abi.decode(data[i], (uint256, address));\n _unwrapNative(minAmountOut, to);\n } else if (actions[i] == ActionType.sweep) {\n (address tokenOut, uint256 minAmountOut, address to) = abi.decode(data[i], (address, uint256, address));\n _sweep(tokenOut, minAmountOut, to);\n } else if (actions[i] == ActionType.sweepNative) {\n uint256 routerBalance = address(this).balance;\n if (routerBalance != 0) _safeTransferNative(msg.sender, routerBalance);\n } else if (actions[i] == ActionType.oneInch) {\n (address inToken, uint256 minAmountOut, bytes memory payload) = abi.decode(\n data[i],\n (address, uint256, bytes)\n );\n _swapOn1Inch(IERC20(inToken), minAmountOut, payload);\n } else if (actions[i] == ActionType.claimRewards) {\n (address user, address[] memory claimLiquidityGauges) = abi.decode(data[i], (address, address[]));\n _claimRewards(user, claimLiquidityGauges);\n } else if (actions[i] == ActionType.borrower) {\n (\n address collateral,\n address vaultManager,\n address to,\n address who,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n bytes memory repayData\n ) = abi.decode(data[i], (address, address, address, address, ActionBorrowType[], bytes[], bytes));\n dataBorrow = _parseVaultIDs(actionsBorrow, dataBorrow, vaultManager, collateral);\n _changeAllowance(IERC20(collateral), address(vaultManager), type(uint256).max);\n _angleBorrower(vaultManager, actionsBorrow, dataBorrow, to, who, repayData);\n } else if (actions[i] == ActionType.swapper) {\n (\n ISwapper swapperContract,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory payload\n ) = abi.decode(data[i], (ISwapper, IERC20, IERC20, address, uint256, uint256, bytes));\n _swapper(swapperContract, inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, payload);\n } else if (actions[i] == ActionType.mint4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 shares, address to, uint256 maxAmountIn) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _mint4626(savingsRate, shares, to, maxAmountIn);\n } else if (actions[i] == ActionType.deposit4626) {\n (IERC20 token, IERC4626 savingsRate, uint256 amount, address to, uint256 minSharesOut) = abi.decode(\n data[i],\n (IERC20, IERC4626, uint256, address, uint256)\n );\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626(savingsRate, amount, to, minSharesOut);\n } else if (actions[i] == ActionType.deposit4626Referral) {\n (\n IERC20 token,\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) = abi.decode(data[i], (IERC20, IERC4626, uint256, address, uint256, address));\n _changeAllowance(token, address(savingsRate), type(uint256).max);\n _deposit4626Referral(savingsRate, amount, to, minSharesOut, referrer);\n } else if (actions[i] == ActionType.redeem4626) {\n (IERC4626 savingsRate, uint256 shares, address to, uint256 minAmountOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _redeem4626(savingsRate, shares, to, minAmountOut);\n } else if (actions[i] == ActionType.withdraw4626) {\n (IERC4626 savingsRate, uint256 amount, address to, uint256 maxSharesOut) = abi.decode(\n data[i],\n (IERC4626, uint256, address, uint256)\n );\n _withdraw4626(savingsRate, amount, to, maxSharesOut);\n } else {\n _chainSpecificAction(actions[i], data[i]);\n }\n }\n }\n\n /// @notice Wrapper built on top of the base `_deposit4626Referral` function to add a proxy enabling to track\n /// addresses depositing from a certain referring address into an ERC4626 contract\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut) {\n IERC20(token).safeTransferFrom(msg.sender, address(this), amount);\n _changeAllowance(IERC20(token), savings, type(uint256).max);\n sharesOut = _deposit4626Referral(IERC4626(savings), amount, to, minSharesOut, referrer);\n }\n\n /// @notice Wrapper built on top of the base `mixer` function to grant approval to a `VaultManager` contract before performing\n /// actions and then revoking this approval after these actions\n /// @param paramsPermitVaultManager Parameters to sign permit to give allowance to the router for a `VaultManager` contract\n /// @dev In `paramsPermitVaultManager`, the signatures for granting approvals must be given first before the signatures\n /// to revoke approvals\n /// @dev The router contract has been built to be safe to keep approvals as you cannot take an action on a vault you are not\n /// approved for, but people wary about their approvals may want to grant it before immediately revoking it, although this\n /// is just an option\n function mixerVaultManagerPermit(\n PermitVaultManagerType[] memory paramsPermitVaultManager,\n PermitType[] memory paramsPermit,\n ActionType[] calldata actions,\n bytes[] calldata data\n ) external payable virtual {\n uint256 permitVaultManagerLength = paramsPermitVaultManager.length;\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n true,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n } else break;\n }\n mixer(paramsPermit, actions, data);\n // Storing the index at which starting the iteration for revoking approvals in a variable would make the stack\n // too deep\n for (uint256 i; i < permitVaultManagerLength; ++i) {\n if (!paramsPermitVaultManager[i].approved) {\n IVaultManagerFunctions(paramsPermitVaultManager[i].vaultManager).permit(\n paramsPermitVaultManager[i].owner,\n address(this),\n false,\n paramsPermitVaultManager[i].deadline,\n paramsPermitVaultManager[i].v,\n paramsPermitVaultManager[i].r,\n paramsPermitVaultManager[i].s\n );\n }\n }\n }\n\n receive() external payable {}\n\n // ===================== INTERNAL ACTION-RELATED FUNCTIONS =====================\n\n /// @notice Wraps the native token of a chain to its wrapped version\n /// @dev It can be used for ETH to wETH or MATIC to wMATIC\n /// @dev The amount to wrap is to be specified in the `msg.value`\n function _wrapNative() internal virtual returns (uint256) {\n _getNativeWrapper().deposit{ value: msg.value }();\n return msg.value;\n }\n\n /// @notice Unwraps the wrapped version of a token to the native chain token\n /// @dev It can be used for wETH to ETH or wMATIC to MATIC\n function _unwrapNative(uint256 minAmountOut, address to) internal virtual returns (uint256 amount) {\n amount = _getNativeWrapper().balanceOf(address(this));\n _slippageCheck(amount, minAmountOut);\n if (amount != 0) {\n _getNativeWrapper().withdraw(amount);\n _safeTransferNative(to, amount);\n }\n return amount;\n }\n\n /// @notice Internal version of the `claimRewards` function\n /// @dev If the caller wants to send the rewards to another account than `gaugeUser`, it first needs to\n /// call `set_rewards_receiver(otherAccount)` on each `liquidityGauge`\n function _claimRewards(address gaugeUser, address[] memory liquidityGauges) internal virtual {\n uint256 gaugesLength = liquidityGauges.length;\n for (uint256 i; i < gaugesLength; ++i) {\n ILiquidityGauge(liquidityGauges[i]).claim_rewards(gaugeUser);\n }\n }\n\n /// @notice Allows to compose actions on a `VaultManager` (Angle Protocol Borrowing module)\n /// @param vaultManager Address of the vault to perform actions on\n /// @param actionsBorrow Actions type to perform on the vaultManager\n /// @param dataBorrow Data needed for each actions\n /// @param to Address to send the funds to\n /// @param who Swapper address to handle repayments\n /// @param repayData Bytes to use at the discretion of the `msg.sender`\n function _angleBorrower(\n address vaultManager,\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address to,\n address who,\n bytes memory repayData\n ) internal virtual returns (PaymentData memory paymentData) {\n return IVaultManagerFunctions(vaultManager).angle(actionsBorrow, dataBorrow, msg.sender, to, who, repayData);\n }\n\n /// @notice Sweeps tokens from the router contract\n /// @param tokenOut Token to sweep\n /// @param minAmountOut Minimum amount of tokens to recover\n /// @param to Address to which tokens should be sent\n function _sweep(address tokenOut, uint256 minAmountOut, address to) internal virtual {\n uint256 balanceToken = IERC20(tokenOut).balanceOf(address(this));\n _slippageCheck(balanceToken, minAmountOut);\n if (balanceToken != 0) {\n IERC20(tokenOut).safeTransfer(to, balanceToken);\n }\n }\n\n /// @notice Uses an external swapper\n /// @param swapper Contracts implementing the logic of the swap\n /// @param inToken Token used to do the swap\n /// @param outToken Token wanted\n /// @param outTokenRecipient Address who should have at the end of the swap at least `outTokenOwed`\n /// @param outTokenOwed Minimal amount for the `outTokenRecipient`\n /// @param inTokenObtained Amount of `inToken` used for the swap\n /// @param data Additional info for the specific swapper\n function _swapper(\n ISwapper swapper,\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) internal {\n swapper.swap(inToken, outToken, outTokenRecipient, outTokenOwed, inTokenObtained, data);\n }\n\n /// @notice Swaps an inToken to another token via 1Inch Router\n /// @param payload Bytes needed for 1Inch router to process the swap\n /// @dev The `payload` given is expected to be obtained from 1Inch API\n function _swapOn1Inch(\n IERC20 inToken,\n uint256 minAmountOut,\n bytes memory payload\n ) internal returns (uint256 amountOut) {\n // Approve transfer to the `oneInch` address\n // Since this router is supposed to be a trusted contract, we can leave the allowance to the token\n address oneInchRouter = oneInch;\n _changeAllowance(IERC20(inToken), oneInchRouter, type(uint256).max);\n //solhint-disable-next-line\n (bool success, bytes memory result) = oneInchRouter.call(payload);\n if (!success) _revertBytes(result);\n\n amountOut = abi.decode(result, (uint256));\n _slippageCheck(amountOut, minAmountOut);\n }\n\n /// @notice Mints `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to mint shares from\n /// @param shares Amount of shares to mint from the contract\n /// @param to Address to which shares should be sent\n /// @param maxAmountIn Max amount of assets used to mint\n /// @return amountIn Amount of assets used to mint by `to`\n function _mint4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 maxAmountIn\n ) internal returns (uint256 amountIn) {\n _slippageCheck(maxAmountIn, (amountIn = savingsRate.mint(shares, to)));\n }\n\n /// @notice Deposits `amount` to an ERC4626 contract\n /// @param savingsRate The ERC4626 to deposit assets to\n /// @param amount Amount of assets to deposit\n /// @param to Address to which shares should be sent\n /// @param minSharesOut Minimum amount of shares that `to` should received\n /// @return sharesOut Amount of shares received by `to`\n function _deposit4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(sharesOut = savingsRate.deposit(amount, to), minSharesOut);\n }\n\n /// @notice Same as _deposit4626 but with the ability to specify a referring address\n function _deposit4626Referral(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) internal returns (uint256 sharesOut) {\n sharesOut = _deposit4626(savingsRate, amount, to, minSharesOut);\n emit ReferredDeposit(msg.sender, to, amount, sharesOut, address(savingsRate), referrer);\n }\n\n /// @notice Withdraws `amount` from an ERC4626 contract\n /// @param savingsRate ERC4626 to withdraw assets from\n /// @param amount Amount of assets to withdraw\n /// @param to Destination of assets\n /// @param maxSharesOut Maximum amount of shares that should be burnt in the operation\n /// @return sharesOut Amount of shares burnt\n function _withdraw4626(\n IERC4626 savingsRate,\n uint256 amount,\n address to,\n uint256 maxSharesOut\n ) internal returns (uint256 sharesOut) {\n _slippageCheck(maxSharesOut, sharesOut = savingsRate.withdraw(amount, to, msg.sender));\n }\n\n /// @notice Redeems `shares` from an ERC4626 contract\n /// @param savingsRate ERC4626 to redeem shares from\n /// @param shares Amount of shares to redeem\n /// @param to Destination of assets\n /// @param minAmountOut Minimum amount of assets that `to` should receive in the redemption process\n /// @return amountOut Amount of assets received by `to`\n function _redeem4626(\n IERC4626 savingsRate,\n uint256 shares,\n address to,\n uint256 minAmountOut\n ) internal returns (uint256 amountOut) {\n _slippageCheck(amountOut = savingsRate.redeem(shares, to, msg.sender), minAmountOut);\n }\n\n /// @notice Allows to perform some specific actions for a chain\n function _chainSpecificAction(ActionType action, bytes calldata data) internal virtual {}\n\n // ======================= VIRTUAL FUNCTIONS TO OVERRIDE =======================\n\n /// @notice Gets the official wrapper of the native token on a chain (like wETH on Ethereum)\n function _getNativeWrapper() internal pure virtual returns (IWETH9);\n\n // ============================ GOVERNANCE FUNCTION ============================\n\n /// @notice Checks whether the `msg.sender` has the governor role or the guardian role\n modifier onlyGovernorOrGuardian() {\n if (!core.isGovernorOrGuardian(msg.sender)) revert NotGovernorOrGuardian();\n _;\n }\n\n /// @notice Sets a new `core` contract\n function setCore(ICoreBorrow _core) external {\n if (!core.isGovernor(msg.sender) || !_core.isGovernor(msg.sender)) revert NotGovernor();\n core = ICoreBorrow(_core);\n }\n\n /// @notice Changes allowances for different tokens\n /// @param tokens Addresses of the tokens to allow\n /// @param spenders Addresses to allow transfer\n /// @param amounts Amounts to allow\n function changeAllowance(\n IERC20[] calldata tokens,\n address[] calldata spenders,\n uint256[] calldata amounts\n ) external onlyGovernorOrGuardian {\n uint256 tokensLength = tokens.length;\n if (tokensLength != spenders.length || tokensLength != amounts.length) revert IncompatibleLengths();\n for (uint256 i; i < tokensLength; ++i) {\n _changeAllowance(tokens[i], spenders[i], amounts[i]);\n }\n }\n\n /// @notice Sets a new router variable\n function setRouter(address router, uint8 who) external onlyGovernorOrGuardian {\n if (router == address(0)) revert ZeroAddress();\n if (who == 0) uniswapV3Router = IUniswapV3Router(router);\n else oneInch = router;\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Changes allowance of this contract for a given token\n /// @param token Address of the token to change allowance\n /// @param spender Address to change the allowance of\n /// @param amount Amount allowed\n function _changeAllowance(IERC20 token, address spender, uint256 amount) internal {\n uint256 currentAllowance = token.allowance(address(this), spender);\n // In case `currentAllowance < type(uint256).max / 2` and we want to increase it:\n // Do nothing (to handle tokens that need reapprovals to 0 and save gas)\n if (currentAllowance < amount && currentAllowance < type(uint256).max / 2) {\n token.safeIncreaseAllowance(spender, amount - currentAllowance);\n } else if (currentAllowance > amount) {\n token.safeDecreaseAllowance(spender, currentAllowance - amount);\n }\n }\n\n /// @notice Transfer amount of the native token to the `to` address\n /// @dev Forked from Solmate: https://github.com/Rari-Capital/solmate/blob/main/src/utils/SafeTransferLib.sol\n function _safeTransferNative(address to, uint256 amount) internal {\n bool success;\n //solhint-disable-next-line\n assembly {\n // Transfer the ETH and store if it succeeded or not.\n success := call(gas(), to, amount, 0, 0, 0, 0)\n }\n if (!success) revert TransferFailed();\n }\n\n /// @notice Parses the actions submitted to the router contract to interact with a `VaultManager` and makes sure that\n /// the calling address is well approved for all the vaults with which it is interacting\n /// @dev If such check was not made, we could end up in a situation where an address has given an approval for all its\n /// vaults to the router contract, and another address takes advantage of this to instruct actions on these other vaults\n /// to the router: it is hence super important for the router to pay attention to the fact that the addresses interacting\n /// with a vault are approved for this vault\n function _parseVaultIDs(\n ActionBorrowType[] memory actionsBorrow,\n bytes[] memory dataBorrow,\n address vaultManager,\n address collateral\n ) internal view returns (bytes[] memory) {\n uint256 actionsBorrowLength = actionsBorrow.length;\n uint256[] memory vaultIDsToCheckOwnershipOf = new uint256[](actionsBorrowLength);\n bool createVaultAction;\n uint256 lastVaultID;\n uint256 vaultIDLength;\n for (uint256 i; i < actionsBorrowLength; ++i) {\n uint256 vaultID;\n // If there is a `createVault` action, the router should not worry about looking at\n // next vaultIDs given equal to 0\n if (actionsBorrow[i] == ActionBorrowType.createVault) {\n createVaultAction = true;\n continue;\n // If the action is a `addCollateral` action, we should check whether a max amount was given to end up adding\n // as collateral the full contract balance\n } else if (actionsBorrow[i] == ActionBorrowType.addCollateral) {\n uint256 amount;\n (vaultID, amount) = abi.decode(dataBorrow[i], (uint256, uint256));\n if (amount == type(uint256).max)\n dataBorrow[i] = abi.encode(vaultID, IERC20(collateral).balanceOf(address(this)));\n continue;\n // There are different ways depending on the action to find the `vaultID` to parse\n } else if (\n actionsBorrow[i] == ActionBorrowType.removeCollateral || actionsBorrow[i] == ActionBorrowType.borrow\n ) {\n (vaultID, ) = abi.decode(dataBorrow[i], (uint256, uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.closeVault) {\n vaultID = abi.decode(dataBorrow[i], (uint256));\n } else if (actionsBorrow[i] == ActionBorrowType.getDebtIn) {\n (vaultID, , , ) = abi.decode(dataBorrow[i], (uint256, address, uint256, uint256));\n } else continue;\n // If we need to add a null `vaultID`, we look at the `vaultIDCount` in the `VaultManager`\n // if there has not been any specific action\n if (vaultID == 0) {\n if (createVaultAction) {\n continue;\n } else {\n // If we haven't stored the last `vaultID`, we need to fetch it\n if (lastVaultID == 0) {\n lastVaultID = IVaultManagerStorage(vaultManager).vaultIDCount();\n }\n vaultID = lastVaultID;\n }\n }\n\n // Check if this `vaultID` has already been verified\n for (uint256 j; j < vaultIDLength; ++j) {\n if (vaultIDsToCheckOwnershipOf[j] == vaultID) {\n // If yes, we continue to the next iteration\n continue;\n }\n }\n // Verify this new `vaultID` and add it to the list\n if (!IVaultManagerFunctions(vaultManager).isApprovedOrOwner(msg.sender, vaultID)) {\n revert NotApprovedOrOwner();\n }\n vaultIDsToCheckOwnershipOf[vaultIDLength] = vaultID;\n vaultIDLength += 1;\n }\n return dataBorrow;\n }\n\n /// @notice Checks whether the amount obtained during a swap is not too small\n function _slippageCheck(uint256 amount, uint256 thresholdAmount) internal pure {\n if (amount < thresholdAmount) revert TooSmallAmountOut();\n }\n\n /// @notice Internal function used for error handling\n function _revertBytes(bytes memory errMsg) internal pure {\n if (errMsg.length != 0) {\n //solhint-disable-next-line\n assembly {\n revert(add(32, errMsg), mload(errMsg))\n }\n }\n revert InvalidReturnMessage();\n }\n}\n" + }, + "contracts/implementations/arbitrum/AngleRouterArbitrum.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterArbitrum\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Arbitrum\ncontract AngleRouterArbitrum is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x82aF49447D8a07e3bd95BD0d56f35241523fBab1);\n }\n}\n" + }, + "contracts/implementations/avalanche/AngleRouterAvalanche.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterAvalanche\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Avalanche\ncontract AngleRouterAvalanche is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7);\n }\n}\n" + }, + "contracts/implementations/base/AngleRouterBase.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterBase\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Base\ncontract AngleRouterBase is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/celo/AngleRouterCelo.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterCelo\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Celo\ncontract AngleRouterCelo is BaseRouter {\n /// @inheritdoc BaseRouter\n /// @dev There is no wCELO contract on CELO\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0000000000000000000000000000000000000000);\n }\n}\n" + }, + "contracts/implementations/gnosis/AngleRouterGnosis.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterGnosis\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Gnosis\ncontract AngleRouterGnosis is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xe91D153E0b41518A2Ce8Dd3D7944Fa863463a97d);\n }\n}\n" + }, + "contracts/implementations/mainnet/AngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../interfaces/IFeeDistributorFront.sol\";\nimport \"../../interfaces/ISanToken.sol\";\nimport \"../../interfaces/IStableMasterFront.sol\";\nimport \"../../interfaces/IVeANGLE.sol\";\n\nimport \"../../BaseRouter.sol\";\n\n// ============================= STRUCTS AND ENUMS =============================\n\n/// @notice References to the contracts associated to a collateral for a stablecoin\nstruct Pairs {\n IPoolManager poolManager;\n IPerpetualManagerFrontWithClaim perpetualManager;\n ISanToken sanToken;\n ILiquidityGauge gauge;\n}\n\n/// @title AngleRouterMainnet\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Ethereum\n/// @dev Previous implementation with an initialization function can be found here:\n/// https://etherscan.io/address/0x1b2ffdad478d8770ea0e085bdd4e31120736fcd7#code\ncontract AngleRouterMainnet is BaseRouter {\n using SafeERC20 for IERC20;\n\n // =================================== ERRORS ==================================\n\n error InvalidParams();\n\n // ================================== MAPPINGS =================================\n\n /// @notice Maps an agToken to its counterpart `StableMaster`\n mapping(IERC20 => IStableMasterFront) public mapStableMasters;\n /// @notice Maps a `StableMaster` to a mapping of collateral token to its counterpart `PoolManager`\n mapping(IStableMasterFront => mapping(IERC20 => Pairs)) public mapPoolManagers;\n\n uint256[48] private __gapMainnet;\n\n // =========================== ROUTER FUNCTIONALITIES ==========================\n\n /// @inheritdoc BaseRouter\n function _chainSpecificAction(ActionType action, bytes calldata data) internal override {\n if (action == ActionType.claimWeeklyInterest) {\n (address user, address feeDistributor, bool letInContract) = abi.decode(data, (address, address, bool));\n _claimWeeklyInterest(user, IFeeDistributorFront(feeDistributor), letInContract);\n } else if (action == ActionType.veANGLEDeposit) {\n (address user, uint256 amount) = abi.decode(data, (address, uint256));\n _depositOnLocker(user, amount);\n }\n }\n\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n }\n\n /// @notice Deposits ANGLE on an existing locker\n /// @param user Address to deposit for\n /// @param amount Amount to deposit\n function _depositOnLocker(address user, uint256 amount) internal {\n _getVeANGLE().deposit_for(user, amount);\n }\n\n /// @notice Claims weekly interest distribution and if wanted transfers it to the contract for future use\n /// @param user Address to claim for\n /// @param _feeDistributor Address of the fee distributor to claim to\n /// @dev If `letInContract` (and hence if funds are transferred to the router), you should approve the `angleRouter` to\n /// transfer the token claimed from the `feeDistributor`\n function _claimWeeklyInterest(\n address user,\n IFeeDistributorFront _feeDistributor,\n bool letInContract\n ) internal {\n uint256 amount = _feeDistributor.claim(user);\n if (letInContract) {\n // Fetching info from the `FeeDistributor` to process correctly the withdrawal\n IERC20 token = IERC20(_feeDistributor.token());\n token.safeTransferFrom(msg.sender, address(this), amount);\n }\n }\n\n // ========================= INTERNAL UTILITY FUNCTIONS ========================\n\n /// @notice Returns the veANGLE address\n function _getVeANGLE() internal view virtual returns (IVeANGLE) {\n return IVeANGLE(0x0C462Dbb9EC8cD1630f1728B2CFD2769d09f0dd5);\n }\n}\n" + }, + "contracts/implementations/optimism/AngleRouterOptimism.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterOptimism\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Optimism\ncontract AngleRouterOptimism is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x4200000000000000000000000000000000000006);\n }\n}\n" + }, + "contracts/implementations/polygon/AngleRouterPolygon.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../../BaseRouter.sol\";\n\n/// @title AngleRouterPolygon\n/// @author Angle Core Team\n/// @notice Router contract built specifially for Angle use cases on Polygon\ncontract AngleRouterPolygon is BaseRouter {\n /// @inheritdoc BaseRouter\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return IWETH9(0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270);\n }\n}\n" + }, + "contracts/interfaces/external/IWETH9.sol": { + "content": "// SPDX-License-Identifier: GPL-2.0-or-later\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n/// @title Interface for WETH9\ninterface IWETH9 is IERC20 {\n /// @notice Deposit ether to get wrapped ether\n function deposit() external payable;\n\n /// @notice Withdraw wrapped ether to get ether\n function withdraw(uint256) external;\n}\n" + }, + "contracts/interfaces/external/uniswap/IUniswapRouter.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nstruct ExactInputParams {\n bytes path;\n address recipient;\n uint256 deadline;\n uint256 amountIn;\n uint256 amountOutMinimum;\n}\n\n/// @title Router token swapping functionality\n/// @notice Functions for swapping tokens via Uniswap V3\ninterface IUniswapV3Router {\n /// @notice Swaps `amountIn` of one token for as much as possible of another along the specified path\n /// @param params The parameters necessary for the multi-hop swap, encoded as `ExactInputParams` in calldata\n /// @return amountOut The amount of the received token\n function exactInput(ExactInputParams calldata params) external payable returns (uint256 amountOut);\n}\n\n/// @title Router for price estimation functionality\n/// @notice Functions for getting the price of one token with respect to another using Uniswap V2\n/// @dev This interface is only used for non critical elements of the protocol\ninterface IUniswapV2Router {\n /// @notice Given an input asset amount, returns the maximum output amount of the\n /// other asset (accounting for fees) given reserves.\n /// @param path Addresses of the pools used to get prices\n function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns (uint256[] memory amounts);\n\n function swapExactTokensForTokens(\n uint256 swapAmount,\n uint256 minExpected,\n address[] calldata path,\n address receiver,\n uint256 swapDeadline\n ) external;\n}\n" + }, + "contracts/interfaces/ICoreBorrow.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ICoreBorrow\n/// @author Angle Core Team\n/// @notice Interface for the `CoreBorrow` contract\n\ninterface ICoreBorrow {\n /// @notice Checks whether an address is governor of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GOVERNOR_ROLE` or not\n function isGovernor(address admin) external view returns (bool);\n\n /// @notice Checks whether an address is governor or a guardian of the Angle Protocol or not\n /// @param admin Address to check\n /// @return Whether the address has the `GUARDIAN_ROLE` or not\n /// @dev Governance should make sure when adding a governor to also give this governor the guardian\n /// role by calling the `addGovernor` function\n function isGovernorOrGuardian(address admin) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IDepositWithReferral.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity >=0.5.0;\n\n/// @title IDepositWithReferral\n/// @author Angle Core Team\n/// @notice Interface for Angle routing contract to notably deposit into ERC4626 with a referral address\ninterface IDepositWithReferral {\n /// @notice Deposits `amount` of `token` into an ERC4626 `savings` contract (with `token` as an asset)\n /// @param minSharesOut Minimum amount of shares of the ERC4626 the deposit should return. If less is\n /// obtained, the function reverts\n /// @param referrer Address which referred `msg.sender` to deposit into `savings`. Any address can be entered\n /// and the referrer address has no storage implication, it just changes the event emitted by this contract\n /// when a deposit takes place\n /// @dev This function is a wrapper on top of the base `deposit` function of ERC4626 with the ability to\n /// specify a referring address (`referrer`) as well as a slippage parameter (`minSharesOut`)\n function deposit4626Referral(\n address token,\n address savings,\n uint256 amount,\n address to,\n uint256 minSharesOut,\n address referrer\n ) external returns (uint256 sharesOut);\n}\n" + }, + "contracts/interfaces/IFeeDistributorFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title IFeeDistributorFront\n/// @author Interface for public use of the `FeeDistributor` contract\n/// @dev This interface is used for user related function\ninterface IFeeDistributorFront {\n function token() external returns (address);\n\n function claim(address _addr) external returns (uint256);\n\n function claim(address[20] memory _addr) external returns (bool);\n}\n" + }, + "contracts/interfaces/ILiquidityGauge.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface ILiquidityGauge {\n // solhint-disable-next-line\n function staking_token() external returns (address stakingToken);\n\n // solhint-disable-next-line\n function deposit_reward_token(address _rewardToken, uint256 _amount) external;\n\n function deposit(\n uint256 _value,\n address _addr,\n // solhint-disable-next-line\n bool _claim_rewards\n ) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr) external;\n\n // solhint-disable-next-line\n function claim_rewards(address _addr, address _receiver) external;\n}\n" + }, + "contracts/interfaces/IPerpetualManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title Interface of the contract managing perpetuals with claim function\n/// @author Angle Core Team\n/// @dev Front interface with rewards function, meaning only user-facing functions\ninterface IPerpetualManagerFrontWithClaim {\n function getReward(uint256 perpetualID) external;\n\n function addToPerpetual(uint256 perpetualID, uint256 amount) external;\n\n function openPerpetual(\n address owner,\n uint256 amountBrought,\n uint256 amountCommitted,\n uint256 maxOracleRate,\n uint256 minNetMargin\n ) external returns (uint256 perpetualID);\n}\n" + }, + "contracts/interfaces/IPoolManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\ninterface IPoolManager {\n function token() external view returns (address);\n}\n" + }, + "contracts/interfaces/ISanToken.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\ninterface ISanToken is IERC20Upgradeable {}\n" + }, + "contracts/interfaces/IStableMasterFront.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"./IPoolManager.sol\";\nimport \"./ISanToken.sol\";\nimport \"./IPerpetualManager.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\n\n// Struct to handle all the parameters to manage the fees\n// related to a given collateral pool (associated to the stablecoin)\nstruct MintBurnData {\n // Values of the thresholds to compute the minting fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeMint;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeMint;\n // Values of the thresholds to compute the burning fees\n // depending on HA hedge (scaled by `BASE_PARAMS`)\n uint64[] xFeeBurn;\n // Values of the fees at thresholds (scaled by `BASE_PARAMS`)\n uint64[] yFeeBurn;\n // Max proportion of collateral from users that can be covered by HAs\n // It is exactly the same as the parameter of the same name in `PerpetualManager`, whenever one is updated\n // the other changes accordingly\n uint64 targetHAHedge;\n // Minting fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusMint;\n // Burning fees correction set by the `FeeManager` contract: they are going to be multiplied\n // to the value of the fees computed using the hedge curve\n // Scaled by `BASE_PARAMS`\n uint64 bonusMalusBurn;\n // Parameter used to limit the number of stablecoins that can be issued using the concerned collateral\n uint256 capOnStableMinted;\n}\n\n// Struct to handle all the variables and parameters to handle SLPs in the protocol\n// including the fraction of interests they receive or the fees to be distributed to\n// them\nstruct SLPData {\n // Last timestamp at which the `sanRate` has been updated for SLPs\n uint256 lastBlockUpdated;\n // Fees accumulated from previous blocks and to be distributed to SLPs\n uint256 lockedInterests;\n // Max interests used to update the `sanRate` in a single block\n // Should be in collateral token base\n uint256 maxInterestsDistributed;\n // Amount of fees left aside for SLPs and that will be distributed\n // when the protocol is collateralized back again\n uint256 feesAside;\n // Part of the fees normally going to SLPs that is left aside\n // before the protocol is collateralized back again (depends on collateral ratio)\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippageFee;\n // Portion of the fees from users minting and burning\n // that goes to SLPs (the rest goes to surplus)\n uint64 feesForSLPs;\n // Slippage factor that's applied to SLPs exiting (depends on collateral ratio)\n // If `slippage = BASE_PARAMS`, SLPs can get nothing, if `slippage = 0` they get their full claim\n // Updated by keepers and scaled by `BASE_PARAMS`\n uint64 slippage;\n // Portion of the interests from lending\n // that goes to SLPs (the rest goes to surplus)\n uint64 interestsForSLPs;\n}\n\n/// @title IStableMasterFront\n/// @author Angle Core Team\n/// @dev Front interface, meaning only user-facing functions\ninterface IStableMasterFront {\n function collateralMap(IPoolManager poolManager)\n external\n view\n returns (\n IERC20 token,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n address oracle,\n uint256 stocksUsers,\n uint256 sanRate,\n uint256 collatBase,\n SLPData memory slpData,\n MintBurnData memory feeData\n );\n\n function updateStocksUsers(uint256 amount, address poolManager) external;\n\n function mint(\n uint256 amount,\n address user,\n IPoolManager poolManager,\n uint256 minStableAmount\n ) external;\n\n function burn(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager,\n uint256 minCollatAmount\n ) external;\n\n function deposit(\n uint256 amount,\n address user,\n IPoolManager poolManager\n ) external;\n\n function withdraw(\n uint256 amount,\n address burner,\n address dest,\n IPoolManager poolManager\n ) external;\n\n function agToken() external returns (address);\n}\n" + }, + "contracts/interfaces/ISwapper.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/interfaces/IERC20.sol\";\n\n/// @title ISwapper\n/// @author Angle Core Team\n/// @notice Interface for a generic swapper, that supports swaps of higher complexity than aggregators\ninterface ISwapper {\n function swap(\n IERC20 inToken,\n IERC20 outToken,\n address outTokenRecipient,\n uint256 outTokenOwed,\n uint256 inTokenObtained,\n bytes memory data\n ) external;\n}\n" + }, + "contracts/interfaces/ITreasury.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\n/// @title ITreasury\n/// @author Angle Core Team\n/// @notice Interface for the `Treasury` contract\n/// @dev This interface only contains functions of the `Treasury` which are called by other contracts\n/// of this module\ninterface ITreasury {\n /// @notice Checks whether a given address has well been initialized in this contract\n /// as a `VaultManager``\n /// @param _vaultManager Address to check\n /// @return Whether the address has been initialized or not\n function isVaultManager(address _vaultManager) external view returns (bool);\n}\n" + }, + "contracts/interfaces/IVaultManager.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts/token/ERC20/IERC20.sol\";\nimport \"./ITreasury.sol\";\n\n// ========================= Key Structs and Enums =============================\n\n/// @notice Data to track during a series of action the amount to give or receive in stablecoins and collateral\n/// to the caller or associated addresses\nstruct PaymentData {\n // Stablecoin amount the contract should give\n uint256 stablecoinAmountToGive;\n // Stablecoin amount owed to the contract\n uint256 stablecoinAmountToReceive;\n // Collateral amount the contract should give\n uint256 collateralAmountToGive;\n // Collateral amount owed to the contract\n uint256 collateralAmountToReceive;\n}\n\n/// @notice Data stored to track someone's loan (or equivalently called position)\nstruct Vault {\n // Amount of collateral deposited in the vault\n uint256 collateralAmount;\n // Normalized value of the debt (that is to say of the stablecoins borrowed)\n uint256 normalizedDebt;\n}\n\n/// @notice Actions possible when composing calls to the different entry functions proposed\nenum ActionBorrowType {\n createVault,\n closeVault,\n addCollateral,\n removeCollateral,\n repayDebt,\n borrow,\n getDebtIn,\n permit\n}\n\n// ========================= Interfaces =============================\n\n/// @title IVaultManagerFunctions\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface only contains functions of the contract which are called by other contracts\n/// of this module (without getters)\ninterface IVaultManagerFunctions {\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Allows composability between calls to the different entry points of this module. Any user calling\n /// this function can perform any of the allowed actions in the order of their choice\n /// @param actions Set of actions to perform\n /// @param datas Data to be decoded for each action: it can include like the `vaultID` or the\n /// @param from Address from which stablecoins will be taken if one action includes burning stablecoins. This address\n /// should either be the `msg.sender` or be approved by the latter\n /// @param to Address to which stablecoins and/or collateral will be sent in case of\n /// @param who Address of the contract to handle in case of repayment of stablecoins from received collateral\n /// @param repayData Data to pass to the repayment contract in case of\n /// @return paymentData Struct containing the final transfers executed\n /// @dev This function is optimized to reduce gas cost due to payment from or to the user and that expensive calls\n /// or computations (like `oracleValue`) are done only once\n function angle(\n ActionBorrowType[] memory actions,\n bytes[] memory datas,\n address from,\n address to,\n address who,\n bytes memory repayData\n ) external payable returns (PaymentData memory paymentData);\n\n /// @notice Checks whether a given address is approved for a vault or owns this vault\n /// @param spender Address for which vault ownership should be checked\n /// @param vaultID ID of the vault to check\n /// @return Whether the `spender` address owns or is approved for `vaultID`\n function isApprovedOrOwner(address spender, uint256 vaultID) external view returns (bool);\n\n /// @notice Allows an address to give or revoke approval for all its vaults to another address\n /// @param owner Address signing the permit and giving (or revoking) its approval for all the controlled vaults\n /// @param spender Address to give approval to\n /// @param approved Whether to give or revoke the approval\n /// @param deadline Deadline parameter for the signature to be valid\n /// @dev The `v`, `r`, and `s` parameters are used as signature data\n function permit(\n address owner,\n address spender,\n bool approved,\n uint256 deadline,\n uint8 v,\n bytes32 r,\n bytes32 s\n ) external;\n}\n\n/// @title IVaultManagerStorage\n/// @author Angle Core Team\n/// @notice Interface for the `VaultManager` contract\n/// @dev This interface contains getters of the contract's public variables used by other contracts\n/// of this module\ninterface IVaultManagerStorage {\n /// @notice Reference to the `treasury` contract handling this `VaultManager`\n function treasury() external view returns (ITreasury);\n\n /// @notice Reference to the collateral handled by this `VaultManager`\n function collateral() external view returns (IERC20);\n\n /// @notice ID of the last vault created. The `vaultIDCount` variables serves as a counter to generate a unique\n /// `vaultID` for each vault: it is like `tokenID` in basic ERC721 contracts\n function vaultIDCount() external view returns (uint256);\n}\n" + }, + "contracts/interfaces/IVeANGLE.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/IERC20Upgradeable.sol\";\n\n/// @title IVeANGLE\n/// @author Angle Core Team\n/// @notice Interface for the `VeANGLE` contract\ninterface IVeANGLE {\n // solhint-disable-next-line func-name-mixedcase\n function deposit_for(address addr, uint256 amount) external;\n}\n" + }, + "contracts/mock/MockAngleRouterMainnet.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"../implementations/mainnet/AngleRouterMainnet.sol\";\n\ncontract MockAngleRouterMainnet is AngleRouterMainnet {\n address public veAngle;\n\n function setAngleAndVeANGLE(address _veAngle) external {\n veAngle = _veAngle;\n }\n\n function _getVeANGLE() internal view override returns (IVeANGLE) {\n return IVeANGLE(veAngle);\n }\n\n function addStableMaster(IERC20 stablecoin, IStableMasterFront stableMaster) external {\n mapStableMasters[stablecoin] = stableMaster;\n }\n\n function addPairs(\n IERC20[] calldata stablecoins,\n IPoolManager[] calldata poolManagers,\n ILiquidityGauge[] calldata liquidityGauges,\n bool[] calldata justLiquidityGauges\n ) external {\n for (uint256 i; i < stablecoins.length; ++i) {\n IStableMasterFront stableMaster = mapStableMasters[stablecoins[i]];\n _addPair(stableMaster, poolManagers[i], liquidityGauges[i], justLiquidityGauges[i]);\n }\n }\n\n function _addPair(\n IStableMasterFront stableMaster,\n IPoolManager poolManager,\n ILiquidityGauge liquidityGauge,\n bool justLiquidityGauge\n ) internal {\n // Fetching the associated `sanToken` and `perpetualManager` from the contract\n (\n IERC20 collateral,\n ISanToken sanToken,\n IPerpetualManagerFrontWithClaim perpetualManager,\n ,\n ,\n ,\n ,\n ,\n\n ) = stableMaster.collateralMap(poolManager);\n // Reverting if the poolManager is not a valid `poolManager`\n if (address(collateral) == address(0)) revert InvalidParams();\n Pairs storage _pairs = mapPoolManagers[stableMaster][collateral];\n if (justLiquidityGauge) {\n // Cannot specify a liquidity gauge if the associated poolManager does not exist\n if (address(_pairs.poolManager) == address(0)) revert ZeroAddress();\n ILiquidityGauge gauge = _pairs.gauge;\n if (address(gauge) != address(0)) {\n _changeAllowance(IERC20(address(sanToken)), address(gauge), 0);\n }\n } else {\n // Checking if the pair has not already been initialized: if yes we need to make the function revert\n // otherwise we could end up with still approved `PoolManager` and `PerpetualManager` contracts\n if (address(_pairs.poolManager) != address(0)) revert InvalidParams();\n _pairs.poolManager = poolManager;\n _pairs.perpetualManager = IPerpetualManagerFrontWithClaim(address(perpetualManager));\n _pairs.sanToken = sanToken;\n _changeAllowance(collateral, address(stableMaster), type(uint256).max);\n _changeAllowance(collateral, address(perpetualManager), type(uint256).max);\n }\n _pairs.gauge = liquidityGauge;\n if (address(liquidityGauge) != address(0)) {\n if (address(sanToken) != liquidityGauge.staking_token()) revert InvalidParams();\n _changeAllowance(IERC20(address(sanToken)), address(liquidityGauge), type(uint256).max);\n }\n }\n}\n\ncontract MockAngleRouterMainnet2 is AngleRouterMainnet {\n function getVeANGLE() external view returns (IVeANGLE) {\n return _getVeANGLE();\n }\n}\n" + }, + "contracts/mock/MockRouterSidechain.sol": { + "content": "// SPDX-License-Identifier: GPL-3.0\n\npragma solidity ^0.8.17;\n\nimport \"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol\";\nimport \"@openzeppelin/contracts-upgradeable/token/ERC20/extensions/draft-IERC20PermitUpgradeable.sol\";\nimport \"@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol\";\n\nimport \"../interfaces/external/IWETH9.sol\";\n\nimport \"../BaseRouter.sol\";\n\n/// @title MockRouterSidechain\n/// @author Angle Core Team\n/// @notice Mock contract but built for tests as if to be deployed on Ethereum\ncontract MockRouterSidechain is BaseRouter {\n IWETH9 public constant WETH = IWETH9(0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2);\n\n function _wrapNative() internal pure override returns (uint256) {\n return 0;\n }\n\n function _unwrapNative(uint256, address) internal pure override returns (uint256 amount) {\n return 0;\n }\n\n function _getNativeWrapper() internal pure override returns (IWETH9) {\n return WETH;\n }\n}\n" + } + }, + "settings": { + "optimizer": { + "enabled": true, + "runs": 1000000 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers", + "metadata", + "devdoc", + "userdoc", + "storageLayout", + "evm.gasEstimates", + "devdoc", + "userdoc" + ], + "": [ + "ast" + ] + } + }, + "metadata": { + "useLiteralContent": true + } + } +} \ No newline at end of file diff --git a/hardhat.config.ts b/hardhat.config.ts index e4ea823..f5d3d81 100644 --- a/hardhat.config.ts +++ b/hardhat.config.ts @@ -21,7 +21,7 @@ import { TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS } from 'hardhat/builtin-tasks/ta import { HardhatUserConfig, subtask } from 'hardhat/config'; import yargs from 'yargs'; -import { accounts, etherscanKey, nodeUrl } from './utils/network'; +import { accounts, etherscanKey, getPkey, nodeUrl } from './utils/network'; // Otherwise, ".sol" files from "test" are picked up during compilation and throw an error subtask(TASK_COMPILE_SOLIDITY_GET_SOURCE_PATHS).setAction(async (_, __, runSuper) => { @@ -100,7 +100,7 @@ const config: HardhatUserConfig = { polygon: { live: true, url: nodeUrl('polygon'), - accounts: accounts('polygon'), + accounts: [getPkey()], gas: 'auto', verify: { etherscan: { @@ -111,7 +111,7 @@ const config: HardhatUserConfig = { mainnet: { live: true, url: nodeUrl('mainnet'), - accounts: accounts('mainnet'), + accounts: [getPkey()], gas: 'auto', gasMultiplier: 1.3, chainId: 1, @@ -129,7 +129,7 @@ const config: HardhatUserConfig = { optimism: { live: true, url: nodeUrl('optimism'), - accounts: accounts('optimism'), + accounts: [getPkey()], gas: 'auto', chainId: 10, verify: { @@ -141,7 +141,7 @@ const config: HardhatUserConfig = { arbitrum: { live: true, url: nodeUrl('arbitrum'), - accounts: accounts('arbitrum'), + accounts: [getPkey()], gas: 'auto', chainId: 42161, verify: { @@ -153,7 +153,7 @@ const config: HardhatUserConfig = { avalanche: { live: true, url: nodeUrl('avalanche'), - accounts: accounts('avalanche'), + accounts: [getPkey()], gas: 'auto', chainId: 43114, verify: { @@ -172,7 +172,7 @@ const config: HardhatUserConfig = { gnosis: { live: true, url: nodeUrl('gnosis'), - accounts: accounts('gnosis'), + accounts: [getPkey()], gas: 'auto', gasMultiplier: 1.3, chainId: 100, @@ -185,7 +185,7 @@ const config: HardhatUserConfig = { polygonzkevm: { live: true, url: nodeUrl('polygonzkevm'), - accounts: accounts('polygonzkevm'), + accounts: [getPkey()], gas: 'auto', gasMultiplier: 1.3, chainId: 1101, @@ -198,7 +198,7 @@ const config: HardhatUserConfig = { base: { live: true, url: nodeUrl('base'), - accounts: accounts('base'), + accounts: [getPkey()], gas: 'auto', gasMultiplier: 1.3, chainId: 8453, @@ -211,7 +211,7 @@ const config: HardhatUserConfig = { celo: { live: true, url: nodeUrl('celo'), - accounts: accounts('celo'), + accounts: [getPkey()], gas: 'auto', gasMultiplier: 1.3, chainId: 42220, diff --git a/package.json b/package.json index 13f0c2a..4b8f6f8 100644 --- a/package.json +++ b/package.json @@ -9,7 +9,7 @@ "coverage": "hardhat coverage", "coverage:foundry": "forge coverage --report", "foundry:setup": "curl -L https://foundry.paradigm.xyz | bash && foundryup && git submodule update --init --recursive", - "deploy": "hardhat deploy --tags routerSidechain --network", + "deploy": "hardhat deploy --tags router --network", "etherscan": "hardhat etherscan-verify --network", "foundry:test": "forge test -vvvv", "hardhat:compile": "hardhat compile", @@ -45,7 +45,7 @@ }, "homepage": "https://github.com/AngleProtocol/angle-borrow#readme", "devDependencies": { - "@angleprotocol/sdk": "1.0.8", + "@angleprotocol/sdk": "2.19.0", "@chainlink/contracts": "0.2.1", "@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers", "@nomiclabs/hardhat-etherscan": "3.1.0", @@ -92,8 +92,8 @@ "graphql": "15.5.1", "graphql-request": "3.4.0", "hardhat": "2.19.4", - "hardhat-abi-exporter": "2.8.0", - "hardhat-contract-sizer": "2.4.0", + "hardhat-abi-exporter": "2.2.1", + "hardhat-contract-sizer": "2.0.3", "hardhat-deploy": "0.11.11", "hardhat-docgen": "1.3.0", "hardhat-gas-reporter": "1.0.4", diff --git a/scripts/e2e/linea/AngleRouterLinea.test.ts b/scripts/e2e/linea/AngleRouterLinea.test.ts new file mode 100644 index 0000000..a02929a --- /dev/null +++ b/scripts/e2e/linea/AngleRouterLinea.test.ts @@ -0,0 +1,144 @@ +import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; +import { BigNumber, BytesLike } from 'ethers'; +import { parseEther, parseUnits } from 'ethers/lib/utils'; +import hre, { contract, ethers } from 'hardhat'; + +import { + AngleRouterLinea, + AngleRouterLinea__factory, + ERC20, + ERC20__factory, + Mock1Inch, + Mock1Inch__factory, + MockAgToken, + MockAgToken__factory, + MockCoreBorrow, + MockCoreBorrow__factory, + MockTokenPermit, + MockTokenPermit__factory, + MockUniswapV3Router, + MockUniswapV3Router__factory, +} from '../../../typechain'; +import { expect } from '../../../utils/chai-setup'; +import { ActionType, TypePermit } from '../../../utils/helpers'; +import { deployUpgradeable, expectApprox, ZERO_ADDRESS } from '../../../test/hardhat/utils/helpers'; + +contract('AngleRouterLinea', () => { + let deployer: SignerWithAddress; + let USDC: MockTokenPermit; + let agEUR: MockAgToken; + let wETH: ERC20; + let core: MockCoreBorrow; + let alice: SignerWithAddress; + let bob: SignerWithAddress; + let uniswap: MockUniswapV3Router; + let oneInch: Mock1Inch; + let router: AngleRouterLinea; + let USDCdecimal: BigNumber; + let permits: TypePermit[]; + + before(async () => { + ({ deployer, alice, bob } = await ethers.getNamedSigners()); + USDCdecimal = BigNumber.from('6'); + wETH = (await ethers.getContractAt(ERC20__factory.abi, '0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f')) as ERC20; + + permits = []; + }); + + beforeEach(async () => { + await hre.network.provider.request({ + method: 'hardhat_reset', + params: [ + { + forking: { + jsonRpcUrl: process.env.ETH_NODE_URI_LINEA, + // Changing Linea fork block breaks some tests + blockNumber: 6958729, + }, + }, + ], + }); + await hre.network.provider.send('hardhat_setBalance', [alice.address, '0x10000000000000000000000000000']); + // If the forked-network state needs to be reset between each test, run this + router = (await deployUpgradeable(new AngleRouterLinea__factory(deployer))) as AngleRouterLinea; + USDC = (await new MockTokenPermit__factory(deployer).deploy('USDC', 'USDC', USDCdecimal)) as MockTokenPermit; + agEUR = (await deployUpgradeable(new MockAgToken__factory(deployer))) as MockAgToken; + await agEUR.initialize('agEUR', 'agEUR', ZERO_ADDRESS, ZERO_ADDRESS); + uniswap = (await new MockUniswapV3Router__factory(deployer).deploy( + USDC.address, + agEUR.address, + )) as MockUniswapV3Router; + oneInch = (await new Mock1Inch__factory(deployer).deploy(USDC.address, agEUR.address)) as Mock1Inch; + core = (await new MockCoreBorrow__factory(deployer).deploy()) as MockCoreBorrow; + await core.toggleGovernor(alice.address); + await core.toggleGuardian(alice.address); + await core.toggleGuardian(bob.address); + await router.initializeRouter(core.address, uniswap.address, oneInch.address); + }); + + describe('mixer', () => { + describe('sweepNative', () => { + it('success - amount transferred to the vault', async () => { + await USDC.mint(alice.address, parseUnits('1', USDCdecimal)); + await USDC.connect(alice).approve(router.address, parseUnits('1', USDCdecimal)); + + const transferData = ethers.utils.defaultAbiCoder.encode( + ['address', 'address', 'uint256'], + [USDC.address, router.address, parseUnits('0.3', USDCdecimal)], + ); + const actions = [ActionType.transfer]; + const dataMixer = [transferData]; + + await router.connect(alice).mixer(permits, actions, dataMixer, { value: parseEther('1') }); + + const actions2 = [ActionType.sweepNative]; + const balance = await ethers.provider.getBalance(alice.address); + await router.connect(alice).mixer(permits, actions2, []); + expectApprox((await ethers.provider.getBalance(alice.address)).sub(balance), parseEther('1'), 0.1); + }); + it('success - when there is no ETH balance', async () => { + const actions = [ActionType.sweepNative]; + const balance = await ethers.provider.getBalance(alice.address); + await router.connect(alice).mixer(permits, actions, []); + expectApprox(await ethers.provider.getBalance(alice.address), balance, 0.1); + }); + }); + describe('wrapNative', () => { + it('success - when there is nothing in the action', async () => { + const actions = [ActionType.wrapNative]; + const dataMixer: BytesLike[] = []; + await router.connect(alice).mixer(permits, actions, dataMixer, { value: parseEther('1') }); + expect(await wETH.balanceOf(router.address)).to.be.equal(parseEther('1')); + }); + }); + describe('unwrapNative', () => { + it('success - when there are no wETH', async () => { + const actions = [ActionType.unwrapNative]; + const unwrapData = ethers.utils.defaultAbiCoder.encode(['uint256', 'address'], [0, bob.address]); + await router.connect(alice).mixer(permits, actions, [unwrapData]); + expect(await wETH.balanceOf(router.address)).to.be.equal(parseEther('0')); + expect(await wETH.balanceOf(bob.address)).to.be.equal(parseEther('0')); + }); + it('reverts - because of slippage wETH', async () => { + const actions = [ActionType.unwrapNative]; + const unwrapData = ethers.utils.defaultAbiCoder.encode(['uint256', 'address'], [parseEther('1'), bob.address]); + await expect(router.connect(alice).mixer(permits, actions, [unwrapData])).to.be.revertedWith( + 'TooSmallAmountOut', + ); + }); + it('success - when there are some wETH', async () => { + const actions = [ActionType.wrapNative]; + const dataMixer: BytesLike[] = []; + await router.connect(alice).mixer(permits, actions, dataMixer, { value: parseEther('1') }); + expect(await wETH.balanceOf(router.address)).to.be.equal(parseEther('1')); + const actions2 = [ActionType.unwrapNative]; + const unwrapData = ethers.utils.defaultAbiCoder.encode(['uint256', 'address'], [0, bob.address]); + const balance = await ethers.provider.getBalance(bob.address); + await router.connect(alice).mixer(permits, actions2, [unwrapData]); + expect(await wETH.balanceOf(router.address)).to.be.equal(parseEther('0')); + expect(await wETH.balanceOf(bob.address)).to.be.equal(parseEther('0')); + expect(await ethers.provider.getBalance(bob.address)).to.be.equal(parseEther('1').add(balance)); + }); + }); + }); +}); diff --git a/test/foundry/RouterSidechainSavingsRateActions.t.sol b/test/foundry/RouterSidechainSavingsRateActions.t.sol index b558712..773c255 100644 --- a/test/foundry/RouterSidechainSavingsRateActions.t.sol +++ b/test/foundry/RouterSidechainSavingsRateActions.t.sol @@ -6,7 +6,7 @@ import { ERC4626 } from "@openzeppelin/contracts/token/ERC20/extensions/ERC4626. import "./BaseTest.t.sol"; import "../../contracts/mock/MockTokenPermit.sol"; import { MockSavingsRate } from "../../contracts/mock/MockSavingsRate.sol"; -import { MockRouterSidechain, IUniswapV3Router, PermitType, ActionType, PermitType, BaseAngleRouterSidechain, BaseRouter } from "../../contracts/mock/MockRouterSidechain.sol"; +import { MockRouterSidechain, IUniswapV3Router, PermitType, ActionType, PermitType, BaseRouter } from "../../contracts/mock/MockRouterSidechain.sol"; contract RouterSidechainSavingsRateActionsTest is BaseTest { IUniswapV3Router public constant uniswapV3Router = IUniswapV3Router(0xE592427A0AEce92De3Edee1F18E0157C05861564); diff --git a/test/hardhat/router/baseAngleRouterSidechain.test.ts b/test/hardhat/router/baseAngleRouterSidechain.test.ts deleted file mode 100644 index 0f0d6ee..0000000 --- a/test/hardhat/router/baseAngleRouterSidechain.test.ts +++ /dev/null @@ -1,312 +0,0 @@ -import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; -import { BigNumber, Signer } from 'ethers'; -import { parseEther, parseUnits } from 'ethers/lib/utils'; -import hre, { contract, ethers } from 'hardhat'; - -import { - Mock1Inch, - Mock1Inch__factory, - MockAgToken, - MockAgToken__factory, - MockCoreBorrow, - MockCoreBorrow__factory, - MockLiquidityGauge, - MockLiquidityGauge__factory, - MockRouterSidechain, - MockRouterSidechain__factory, - MockTokenPermit, - MockTokenPermit__factory, - MockUniswapV3Router, - MockUniswapV3Router__factory, -} from '../../../typechain'; -import { expect } from '../../../utils/chai-setup'; -import { ActionType, TypePermit } from '../../../utils/helpers'; -import { deployUpgradeable, MAX_UINT256, ZERO_ADDRESS } from '../utils/helpers'; - -contract('BaseAngleRouterSideChain', () => { - // As a proxy for the BaseAngleRouterSideChain we're using a mock Ethereum implementation of it - let deployer: SignerWithAddress; - let USDC: MockTokenPermit; - let lzAgEUR: MockTokenPermit; - let agEUR: MockAgToken; - let core: MockCoreBorrow; - let alice: SignerWithAddress; - let bob: SignerWithAddress; - let uniswap: MockUniswapV3Router; - let oneInch: Mock1Inch; - let router: MockRouterSidechain; - let USDCdecimal: BigNumber; - let governor: string; - let guardian: string; - let permits: TypePermit[]; - - const impersonatedSigners: { [key: string]: Signer } = {}; - - before(async () => { - ({ deployer, alice, bob } = await ethers.getNamedSigners()); - // add any addresses you want to impersonate here - governor = '0xdC4e6DFe07EFCa50a197DF15D9200883eF4Eb1c8'; - guardian = '0x0C2553e4B9dFA9f83b1A6D3EAB96c4bAaB42d430'; - const impersonatedAddresses = [governor, guardian]; - - for (const address of impersonatedAddresses) { - await hre.network.provider.request({ - method: 'hardhat_impersonateAccount', - params: [address], - }); - await hre.network.provider.send('hardhat_setBalance', [address, '0x10000000000000000000000000000']); - impersonatedSigners[address] = await ethers.getSigner(address); - } - USDCdecimal = BigNumber.from('6'); - - permits = []; - }); - - beforeEach(async () => { - // If the forked-network state needs to be reset between each test, run this - router = (await deployUpgradeable(new MockRouterSidechain__factory(deployer))) as MockRouterSidechain; - USDC = (await new MockTokenPermit__factory(deployer).deploy('USDC', 'USDC', USDCdecimal)) as MockTokenPermit; - lzAgEUR = (await new MockTokenPermit__factory(deployer).deploy('lzAgEUR', 'lzAgEUR', '18')) as MockTokenPermit; - agEUR = (await deployUpgradeable(new MockAgToken__factory(deployer))) as MockAgToken; - await agEUR.initialize('agEUR', 'agEUR', ZERO_ADDRESS, ZERO_ADDRESS); - uniswap = (await new MockUniswapV3Router__factory(deployer).deploy( - USDC.address, - agEUR.address, - )) as MockUniswapV3Router; - oneInch = (await new Mock1Inch__factory(deployer).deploy(USDC.address, agEUR.address)) as Mock1Inch; - core = (await new MockCoreBorrow__factory(deployer).deploy()) as MockCoreBorrow; - await core.toggleGovernor(governor); - await core.toggleGuardian(governor); - await core.toggleGuardian(guardian); - await router.initializeRouter(core.address, uniswap.address, oneInch.address); - }); - - describe('claimRewards', () => { - it('success - when one gauge', async () => { - const gauge = (await new MockLiquidityGauge__factory(deployer).deploy(USDC.address)) as MockLiquidityGauge; - await router.claimRewards(bob.address, [gauge.address]); - }); - }); - describe('mixer', () => { - describe('non supported action', () => { - it('success - nothing happens', async () => { - const actions = [ActionType.veANGLEDeposit, ActionType.addToPerpetual]; - const data1 = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [lzAgEUR.address, router.address, parseEther('1')], - ); - await router.connect(alice).mixer(permits, actions, [data1, data1]); - }); - }); - describe('swapIn', () => { - it('reverts - without approval from the contract', async () => { - const actions = [ActionType.transfer, ActionType.swapIn]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [lzAgEUR.address, router.address, parseEther('1')], - ); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('1'), bob.address], - ); - await lzAgEUR.mint(alice.address, parseEther('1')); - await lzAgEUR.connect(alice).approve(router.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - - await expect(router.connect(alice).mixer(permits, actions, dataMixer)).to.be.reverted; - }); - it('success - with approval from the contract', async () => { - const actions = [ActionType.transfer, ActionType.swapIn]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [lzAgEUR.address, router.address, parseEther('1')], - ); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('1'), bob.address], - ); - await lzAgEUR.mint(alice.address, parseEther('1')); - await lzAgEUR.connect(alice).approve(router.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - await router - .connect(impersonatedSigners[governor]) - .changeAllowance([lzAgEUR.address], [agEUR.address], [MAX_UINT256]); - - await router.connect(alice).mixer(permits, actions, dataMixer); - expect(await agEUR.balanceOf(bob.address)).to.be.equal(parseEther('1')); - expect(await lzAgEUR.balanceOf(agEUR.address)).to.be.equal(parseEther('1')); - }); - it('success - with approval from the contract and fees', async () => { - const actions = [ActionType.transfer, ActionType.swapIn]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [lzAgEUR.address, router.address, parseEther('1')], - ); - - await agEUR.setFees(parseUnits('0.5', 9), parseUnits('1', 9)); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('0.5'), bob.address], - ); - await lzAgEUR.mint(alice.address, parseEther('1')); - await lzAgEUR.connect(alice).approve(router.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - await router - .connect(impersonatedSigners[governor]) - .changeAllowance([lzAgEUR.address], [agEUR.address], [MAX_UINT256]); - - await router.connect(alice).mixer(permits, actions, dataMixer); - expect(await agEUR.balanceOf(bob.address)).to.be.equal(parseEther('0.5')); - expect(await lzAgEUR.balanceOf(agEUR.address)).to.be.equal(parseEther('1')); - }); - it('reverts - when slippage from the contract and fees', async () => { - const actions = [ActionType.transfer, ActionType.swapIn]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [lzAgEUR.address, router.address, parseEther('1')], - ); - await agEUR.setFees(parseUnits('0.5', 9), parseUnits('1', 9)); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('1'), bob.address], - ); - await lzAgEUR.mint(alice.address, parseEther('1')); - await lzAgEUR.connect(alice).approve(router.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - await router - .connect(impersonatedSigners[governor]) - .changeAllowance([lzAgEUR.address], [agEUR.address], [MAX_UINT256]); - - await expect(router.connect(alice).mixer(permits, actions, dataMixer)).to.be.revertedWith('TooSmallAmountOut'); - }); - it('reverts - when slippage', async () => { - const actions = [ActionType.transfer, ActionType.swapIn]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [lzAgEUR.address, router.address, parseEther('1')], - ); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('2'), bob.address], - ); - await lzAgEUR.mint(alice.address, parseEther('1')); - await lzAgEUR.connect(alice).approve(router.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - await router - .connect(impersonatedSigners[governor]) - .changeAllowance([lzAgEUR.address], [agEUR.address], [MAX_UINT256]); - - await expect(router.connect(alice).mixer(permits, actions, dataMixer)).to.be.revertedWith('TooSmallAmountOut'); - }); - }); - describe('swapOut', () => { - it('reverts - when there are no bridge tokens in the contract', async () => { - const actions = [ActionType.transfer, ActionType.swapOut]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [agEUR.address, router.address, parseEther('1')], - ); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('1'), bob.address], - ); - await agEUR.mint(alice.address, parseEther('1')); - await agEUR.connect(alice).approve(router.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - - await expect(router.connect(alice).mixer(permits, actions, dataMixer)).to.be.reverted; - }); - it('success - with bridge tokens on the contract', async () => { - const actions = [ActionType.transfer, ActionType.swapOut]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [agEUR.address, router.address, parseEther('1')], - ); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('1'), bob.address], - ); - await agEUR.mint(alice.address, parseEther('1')); - await agEUR.connect(alice).approve(router.address, parseEther('1')); - await lzAgEUR.mint(agEUR.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - - await router.connect(alice).mixer(permits, actions, dataMixer); - expect(await agEUR.balanceOf(alice.address)).to.be.equal(parseEther('0')); - expect(await lzAgEUR.balanceOf(bob.address)).to.be.equal(parseEther('1')); - }); - it('success - with approval from the contract and fees', async () => { - const actions = [ActionType.transfer, ActionType.swapOut]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [agEUR.address, router.address, parseEther('1')], - ); - await agEUR.setFees(parseUnits('1', 9), parseUnits('0.5', 9)); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('0.5'), bob.address], - ); - await agEUR.mint(alice.address, parseEther('1')); - await agEUR.connect(alice).approve(router.address, parseEther('1')); - await lzAgEUR.mint(agEUR.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - await router.connect(alice).mixer(permits, actions, dataMixer); - expect(await agEUR.balanceOf(alice.address)).to.be.equal(parseEther('0')); - expect(await lzAgEUR.balanceOf(bob.address)).to.be.equal(parseEther('0.5')); - }); - it('reverts - when slippage from the contract and fees', async () => { - const actions = [ActionType.transfer, ActionType.swapOut]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [agEUR.address, router.address, parseEther('1')], - ); - await agEUR.setFees(parseUnits('1', 9), parseUnits('0.5', 9)); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('1'), bob.address], - ); - await agEUR.mint(alice.address, parseEther('1')); - await agEUR.connect(alice).approve(router.address, parseEther('1')); - await lzAgEUR.mint(agEUR.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - await expect(router.connect(alice).mixer(permits, actions, dataMixer)).to.be.revertedWith('TooSmallAmountOut'); - }); - it('reverts - when slippage', async () => { - const actions = [ActionType.transfer, ActionType.swapOut]; - const transferData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256'], - [agEUR.address, router.address, parseEther('1')], - ); - - const swapInData = ethers.utils.defaultAbiCoder.encode( - ['address', 'address', 'uint256', 'uint256', 'address'], - [agEUR.address, lzAgEUR.address, parseEther('1'), parseEther('2'), bob.address], - ); - await agEUR.mint(alice.address, parseEther('1')); - await agEUR.connect(alice).approve(router.address, parseEther('1')); - await lzAgEUR.mint(agEUR.address, parseEther('1')); - - const dataMixer = [transferData, swapInData]; - await expect(router.connect(alice).mixer(permits, actions, dataMixer)).to.be.revertedWith('TooSmallAmountOut'); - }); - }); - }); -}); diff --git a/utils/network.ts b/utils/network.ts index dc25b78..3c7f175 100644 --- a/utils/network.ts +++ b/utils/network.ts @@ -52,3 +52,11 @@ export function getMnemonic(networkName: string): string { export function accounts(networkName: string): { mnemonic: string; count: number } { return { mnemonic: getMnemonic(networkName), count: 20 }; } + +export function getPkey(): string { + if (process.env.DEPLOYER_PRIVATE_KEY) { + return process.env.DEPLOYER_PRIVATE_KEY; + } else { + return '0x0000000000000000000000000000000000000000000000000000000000000000'; + } +} diff --git a/yarn.lock b/yarn.lock index 6605ea8..1429e04 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2,10 +2,10 @@ # yarn lockfile v1 -"@angleprotocol/sdk@1.0.8": - version "1.0.8" - resolved "https://npm.pkg.github.com/download/@angleprotocol/sdk/1.0.8/d94207a89943a2553c5d5974b2c29dcaf8bf1d75#d94207a89943a2553c5d5974b2c29dcaf8bf1d75" - integrity sha512-6mYynQ5GXI+eTzTWD75rczYD0Y0NICrJRyKlqnNZ2BOPoWLuyGOVuGOzoBNPghxl0DgW5ZNMjl3WXpmlOtpAAg== +"@angleprotocol/sdk@2.19.0": + version "2.19.0" + resolved "https://npm.pkg.github.com/download/@angleprotocol/sdk/2.19.0/fab70b8f9745e22ade307e591005946bcffc3107#fab70b8f9745e22ade307e591005946bcffc3107" + integrity sha512-pxQH7bpdx+WInO5ehpwvvjiUZezg1SznytRsgfXxxX7SbiE9FHaQiamW+KhvvEx/yFQuxvQkj8QnjiiKfvuqxQ== dependencies: "@apollo/client" "^3.7.17" "@typechain/ethers-v5" "^10.0.0" @@ -2714,7 +2714,7 @@ ansi-colors@^3.2.3: resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-3.2.4.tgz#e3a3da4bfbae6c86a9c285625de124a234026fbf" integrity sha512-hHUXGagefjN2iRrID63xckIvotOXOojhQKWIPUZ4mNUZ9nLZW+7FMNoE1lOkEhNWYsx/7ysGIuJYCiMAA9FnrA== -ansi-colors@^4.1.0, ansi-colors@^4.1.1: +ansi-colors@^4.1.1: version "4.1.3" resolved "https://registry.yarnpkg.com/ansi-colors/-/ansi-colors-4.1.3.tgz#37611340eb2243e70cc604cad35d63270d48781b" integrity sha512-/6w/C21Pm1A7aZitlI5Ni/2J6FFQN8i1Cvz3kHABAAbw93v/NlvKdVOqz7CCWz/3iv/JplRSEEZ83XION15ovw== @@ -4486,7 +4486,7 @@ color-name@~1.1.4: resolved "https://registry.yarnpkg.com/color-name/-/color-name-1.1.4.tgz#c2a09a87acbde69543de6f63fa3995c826c536a2" integrity sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA== -colors@1.4.0, colors@^1.1.2: +colors@1.4.0, colors@^1.1.2, colors@^1.4.0: version "1.4.0" resolved "https://registry.yarnpkg.com/colors/-/colors-1.4.0.tgz#c50491479d4c1bdaed2c9ced32cf7c7dc2360f78" integrity sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA== @@ -5077,16 +5077,6 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== -delete-empty@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/delete-empty/-/delete-empty-3.0.0.tgz#f8040f2669f26fa7060bc2304e9859c593b685e8" - integrity sha512-ZUyiwo76W+DYnKsL3Kim6M/UOavPdBJgDYWOmuQhYaZvJH0AXAHbUNyEDtRbBra8wqqr686+63/0azfEk1ebUQ== - dependencies: - ansi-colors "^4.1.0" - minimist "^1.2.0" - path-starts-with "^2.0.0" - rimraf "^2.6.2" - depd@2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" @@ -7493,21 +7483,18 @@ har-validator@~5.1.3: ajv "^6.12.3" har-schema "^2.0.0" -hardhat-abi-exporter@2.8.0: - version "2.8.0" - resolved "https://registry.yarnpkg.com/hardhat-abi-exporter/-/hardhat-abi-exporter-2.8.0.tgz#e7ed6216c16acf84158909d856577f0a8832ec55" - integrity sha512-HQwd9Agr2O5znUg9Dzicw8grsXacoMSQsS5ZhBBNyaxKeVbvxL1Ubm9ss8sSVGr74511a8qiR2Ljm/lsLS9Mew== - dependencies: - "@ethersproject/abi" "^5.5.0" - delete-empty "^3.0.0" +hardhat-abi-exporter@2.2.1: + version "2.2.1" + resolved "https://registry.yarnpkg.com/hardhat-abi-exporter/-/hardhat-abi-exporter-2.2.1.tgz#98ad242d08987d34416c6315729f36f9d544e4fa" + integrity sha512-Um7+RPvJEj+OqWjPoPKlTTkO1Akr10pqpgMk8Pw2jz2wrGv5XQBGNW5aQgGVDUosYktUIWDaEhcwwFKbFsir9A== -hardhat-contract-sizer@2.4.0: - version "2.4.0" - resolved "https://registry.yarnpkg.com/hardhat-contract-sizer/-/hardhat-contract-sizer-2.4.0.tgz#3cc125937aa3d773283851085de99c9bd31a7828" - integrity sha512-ww+Fw5Fq+q6gkVxB8KFvicqZFH5pH9HGZwV4ZSTxd0QrxA162qzLdbScJseUP30VvIBPYN9wpdj0cWlz6M9j6g== +hardhat-contract-sizer@2.0.3: + version "2.0.3" + resolved "https://registry.yarnpkg.com/hardhat-contract-sizer/-/hardhat-contract-sizer-2.0.3.tgz#604455fd803865f81c29f60364e863eaa19395a7" + integrity sha512-iaixOzWxwOSIIE76cl2uk4m9VXI1hKU3bFt+gl7jDhyb2/JB2xOp5wECkfWqAoc4V5lD4JtjldZlpSTbzX+nPQ== dependencies: - chalk "^4.0.0" cli-table3 "^0.6.0" + colors "^1.4.0" hardhat-deploy@0.11.11: version "0.11.11" @@ -10472,11 +10459,6 @@ path-parse@^1.0.6, path-parse@^1.0.7: resolved "https://registry.yarnpkg.com/path-parse/-/path-parse-1.0.7.tgz#fbc114b60ca42b30d9daf5858e4bd68bbedb6735" integrity sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw== -path-starts-with@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/path-starts-with/-/path-starts-with-2.0.0.tgz#ffd6d51926cd497022b44d392196033d5451892f" - integrity sha512-3UHTHbJz5+NLkPafFR+2ycJOjoc4WV2e9qCZCnm71zHiWaFrm1XniLVTkZXvaRgxr1xFh9JsTdicpH2yM03nLA== - path-to-regexp@0.1.7: version "0.1.7" resolved "https://registry.yarnpkg.com/path-to-regexp/-/path-to-regexp-0.1.7.tgz#df604178005f522f15eb4490e7247a1bfaa67f8c" @@ -11380,7 +11362,7 @@ rimraf@2.6.3: dependencies: glob "^7.1.3" -rimraf@^2.2.8, rimraf@^2.6.2, rimraf@^2.6.3: +rimraf@^2.2.8, rimraf@^2.6.3: version "2.7.1" resolved "https://registry.yarnpkg.com/rimraf/-/rimraf-2.7.1.tgz#35797f13a7fdadc566142c29d4f07ccad483e3ec" integrity sha512-uWjbaKIK3T1OSVptzX7Nl6PvQ3qAGtKEtVRjRuazjfL3Bx5eI409VZSqgND+4UNnmzLVdPj9FqFJNPqBZFve4w==