diff --git a/Makefile b/Makefile index e99f473..25310fc 100644 --- a/Makefile +++ b/Makefile @@ -6,11 +6,11 @@ check-configs: checkL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge test --mp test/LiveDeploy.t.sol --fork-url=${L1_RPC_URL} + @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge test --mp test/LiveDeploy.t.sol --fork-url=${L1_RPC_URL} -vvv checkL2: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" - @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge test --mp test/LiveDeploy.t.sol --fork-url=${L2_RPC_URL} + @export LIVE_DEPLOY_READ_FILE_NAME=$(file) && forge test --mp test/LiveDeploy.t.sol --fork-url=${L2_RPC_URL} -vvv deployL1: @echo "Setting environment variable LIVE_DEPLOY_READ_FILE_NAME to $(file)" diff --git a/deployment-config/rariETH-L1.json b/deployment-config/rariETH-L1.json new file mode 100644 index 0000000..108caa2 --- /dev/null +++ b/deployment-config/rariETH-L1.json @@ -0,0 +1,63 @@ +{ + "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "base": "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2", + "boringVaultAndBaseDecimals": "18", + "boringVault": { + "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000015", + "boringVaultName": "Rari ETH", + "boringVaultSymbol": "rariETH", + "address": "0x0000000000000000000000000000000000000000" + }, + "manager": { + "managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000015", + "address": "0x0000000000000000000000000000000000000000" + }, + "accountant": { + "accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000015", + "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "allowedExchangeRateChangeUpper": "10030", + "allowedExchangeRateChangeLower": "9980", + "minimumUpdateDelayInSeconds": "3600", + "managementFee": "0", + "address": "0x0000000000000000000000000000000000000000" + }, + "teller": { + "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000015", + "maxGasForPeer": 200000, + "minGasForPeer": 60000, + "peerEid": 30235, + "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "opMessenger": "0x0000000000000000000000000000000000000000", + "assets": [ + "0xcd5fe23c85820f7b72d0926fc9b05b43e359b7ee", + "0xbf5495efe5db9ce00f80364c8b423567e58d2110", + "0xFAe103DC9cf190eD75350761e95403b7b8aFa6c0", + "0x7f39C581F595B53c5cb19bD0b3f8dA6c935E2Ca0", + "0x9Ba021B0a9b958B5E75cE9f6dff97C7eE52cb3E6" + ], + "dvnIfNoDefault": { + "required": [ + "0x589dEDbD617e0CBcB916A9223F4d1300c294236b" + ], + "optional": [ + "0x380275805876Ff19055EA900CDb2B46a94ecF20D", + "0x8FafAE7Dd957044088b3d0F67359C327c6200d18", + "0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5" + ], + "blockConfirmationsRequiredIfNoDefault": 15, + "optionalThreshold": 2 + }, + "address": "0x0000000000000000000000000000000000000000" + }, + "rolesAuthority": { + "rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000015", + "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "pauser": "0xe5CcB29Cb9C886da329098A184302E2D5Ff0cD9E", + "address": "0x0000000000000000000000000000000000000000" + }, + "decoder": { + "decoderSalt": "0x600000000000000000000000000000000000000000000000000000000000000b", + "address": "0x0000000000000000000000000000000000000000" + } +} \ No newline at end of file diff --git a/deployment-config/rariETH-L2.json b/deployment-config/rariETH-L2.json new file mode 100644 index 0000000..fe242df --- /dev/null +++ b/deployment-config/rariETH-L2.json @@ -0,0 +1,57 @@ +{ + "protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "base": "0x160345fC359604fC6e70E3c5fAcbdE5F7A9342d8", + "boringVaultAndBaseDecimals": "18", + "boringVault": { + "boringVaultSalt": "0x1000000000000000000000000000000000000000000000000000000000000015", + "boringVaultName": "Rari ETH", + "boringVaultSymbol": "rariETH", + "address": "0x0000000000000000000000000000000000000000" + }, + "manager": { + "managerSalt": "0x2000000000000000000000000000000000000000000000000000000000000015", + "address": "0x0000000000000000000000000000000000000000" + }, + "accountant": { + "accountantSalt": "0x3000000000000000000000000000000000000000000000000000000000000015", + "payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "allowedExchangeRateChangeUpper": "10030", + "allowedExchangeRateChangeLower": "9980", + "minimumUpdateDelayInSeconds": "3600", + "managementFee": "0", + "address": "0x0000000000000000000000000000000000000000" + }, + "teller": { + "tellerSalt": "0x4000000000000000000000000000000000000000000000000000000000000015", + "maxGasForPeer": 200000, + "minGasForPeer": 60000, + "peerEid": 30101, + "tellerContractName": "MultiChainLayerZeroTellerWithMultiAssetSupport", + "opMessenger": "0x0000000000000000000000000000000000000000", + "assets": [], + "dvnIfNoDefault": { + "required": [ + "0x0b5e5452d0c9da1bb5fb0664f48313e9667d7820" + ], + "optional": [ + "0xdd7b5e1db4aafd5c8ec3b764efb8ed265aa5445b", + "0x2fa870cee4da57de84d1db36759d4716ad7e5038", + "0xb53648ca1aa054a80159c1175c03679fdc76bf88" + ], + "blockConfirmationsRequiredIfNoDefault": 15, + "optionalThreshold": 2 + }, + "address": "0x0000000000000000000000000000000000000000" + }, + "rolesAuthority": { + "rolesAuthoritySalt": "0x5000000000000000000000000000000000000000000000000000000000000015", + "strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F", + "pauser": "0xe5CcB29Cb9C886da329098A184302E2D5Ff0cD9E", + "address": "0x0000000000000000000000000000000000000000" + }, + "decoder": { + "decoderSalt": "0x600000000000000000000000000000000000000000000000000000000000000b", + "address": "0x0000000000000000000000000000000000000000" + } +} \ No newline at end of file diff --git a/src/base/DecodersAndSanitizers/Protocols/PendleRouterDecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/Protocols/PendleRouterDecoderAndSanitizer.sol index 1e5f86a..2f6a54b 100644 --- a/src/base/DecodersAndSanitizers/Protocols/PendleRouterDecoderAndSanitizer.sol +++ b/src/base/DecodersAndSanitizers/Protocols/PendleRouterDecoderAndSanitizer.sol @@ -233,4 +233,29 @@ abstract contract PendleRouterDecoderAndSanitizer is BaseDecoderAndSanitizer { addressFound = abi.encodePacked(receiver, market); } + + function swapExactTokenForPt( + address receiver, + address market, + uint256 minPtOut, + DecoderCustomTypes.ApproxParams calldata guessPtOut, + DecoderCustomTypes.TokenInput calldata input, + DecoderCustomTypes.LimitOrderData calldata limit + ) + external + pure + virtual + returns (bytes memory addressFound) + { + if ( + input.swapData.swapType != DecoderCustomTypes.SwapType.NONE || input.swapData.extRouter != address(0) + || input.pendleSwap != address(0) || input.tokenIn != input.tokenMintSy + ) revert PendleRouterDecoderAndSanitizer__AggregatorSwapsNotPermitted(); + + if (limit.limitRouter != address(0)) { + revert PendleRouterDecoderAndSanitizer__LimitOrderSwapsNotPermitted(); + } + + addressFound = abi.encodePacked(receiver, market); + } } diff --git a/src/base/DecodersAndSanitizers/Protocols/PumpBTCDecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/Protocols/PumpBTCDecoderAndSanitizer.sol new file mode 100644 index 0000000..d50775c --- /dev/null +++ b/src/base/DecodersAndSanitizers/Protocols/PumpBTCDecoderAndSanitizer.sol @@ -0,0 +1,16 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.21; + +import { BaseDecoderAndSanitizer } from "src/base/DecodersAndSanitizers/BaseDecoderAndSanitizer.sol"; + +abstract contract PumpBTCDecoderAndSanitizer is BaseDecoderAndSanitizer { + //============================== PumpBTC =============================== + + function stake(uint256 amount) external pure virtual returns (bytes memory addressesFound) { + // nothing to sanitize + } + + function unstakeInstant(uint256 amount) external pure virtual returns (bytes memory addressFound) { + // nothing to sanitize + } +} diff --git a/src/base/DecodersAndSanitizers/Protocols/swBTCDecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/Protocols/swBTCDecoderAndSanitizer.sol new file mode 100644 index 0000000..0457236 --- /dev/null +++ b/src/base/DecodersAndSanitizers/Protocols/swBTCDecoderAndSanitizer.sol @@ -0,0 +1,31 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.21; + +import { BaseDecoderAndSanitizer } from "src/base/DecodersAndSanitizers/BaseDecoderAndSanitizer.sol"; + +abstract contract swBTCDecoderAndSanitizer is BaseDecoderAndSanitizer { + //============================== swBTCDecoderAndSanitizer =============================== + + error swBTCDecoderAndSanitizer_ThirdPartyNotSupported(); + + function deposit(uint256, address receiver) external pure virtual returns (bytes memory addressesFound) { + addressesFound = abi.encodePacked(receiver); + } + + function requestWithdraw( + address asset, + uint96 shares, + uint16 maxLoss, + bool allowThirdPartyToComplete + ) + external + pure + virtual + returns (bytes memory addressesFound) + { + if (allowThirdPartyToComplete) { + revert swBTCDecoderAndSanitizer_ThirdPartyNotSupported(); + } + addressesFound = abi.encodePacked(asset); + } +} diff --git a/src/base/DecodersAndSanitizers/earnBTCDecoderAndSanitizer.sol b/src/base/DecodersAndSanitizers/earnBTCDecoderAndSanitizer.sol new file mode 100644 index 0000000..0c4edf0 --- /dev/null +++ b/src/base/DecodersAndSanitizers/earnBTCDecoderAndSanitizer.sol @@ -0,0 +1,55 @@ +// SPDX-License-Identifier: MIT + +pragma solidity 0.8.21; + +import { + PendleRouterDecoderAndSanitizer, + BaseDecoderAndSanitizer +} from "src/base/DecodersAndSanitizers/Protocols/PendleRouterDecoderAndSanitizer.sol"; +import { PumpBTCDecoderAndSanitizer } from "src/base/DecodersAndSanitizers/Protocols/PumpBTCDecoderAndSanitizer.sol"; +import { swBTCDecoderAndSanitizer } from "src/base/DecodersAndSanitizers/Protocols/swBTCDecoderAndSanitizer.sol"; +import { UniswapV3DecoderAndSanitizer } from "src/base/DecodersAndSanitizers/Protocols/UniswapV3DecoderAndSanitizer.sol"; +import { OneInchDecoderAndSanitizer } from "src/base/DecodersAndSanitizers/Protocols/OneInchDecoderAndSanitizer.sol"; +import { BalancerV2DecoderAndSanitizer } from + "src/base/DecodersAndSanitizers/Protocols/BalancerV2DecoderAndSanitizer.sol"; +import { CurveDecoderAndSanitizer } from "src/base/DecodersAndSanitizers/Protocols/CurveDecoderAndSanitizer.sol"; + +contract earnBTCDecoderAndSanitizer is + PendleRouterDecoderAndSanitizer, + PumpBTCDecoderAndSanitizer, + swBTCDecoderAndSanitizer, + UniswapV3DecoderAndSanitizer, + OneInchDecoderAndSanitizer, + BalancerV2DecoderAndSanitizer, + CurveDecoderAndSanitizer +{ + constructor( + address _boringVault, + address _uniswapV3NonFungiblePositionManager + ) + UniswapV3DecoderAndSanitizer(_uniswapV3NonFungiblePositionManager) + BaseDecoderAndSanitizer(_boringVault) + { } + + function deposit( + uint256, + address receiver + ) + external + pure + override(BalancerV2DecoderAndSanitizer, swBTCDecoderAndSanitizer, CurveDecoderAndSanitizer) + returns (bytes memory addressesFound) + { + addressesFound = abi.encodePacked(receiver); + } + + function withdraw(uint256) + external + pure + override(BalancerV2DecoderAndSanitizer, CurveDecoderAndSanitizer) + returns (bytes memory addressesFound) + { + // Nothing to sanitize or return + return addressesFound; + } +}