Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ jobs:
- name: Forge build
run: forge build

- name: Drop problem files
run: rm -rf lib/transparent_upgradeable_beacon_proxy script/ltv_elements/DeployLTVBeaconProxy.s.sol
- name: Run lint
run: FOUNDRY_DISABLE_NIGHTLY_WARNING=1 forge lint && $([ -n "$(forge lint -q 2>&1)" ] && exit 1 || exit 0)

Expand Down
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@
[submodule "lib/openzeppelin-contracts-upgradeable"]
path = lib/openzeppelin-contracts-upgradeable
url = https://github.com/OpenZeppelin/openzeppelin-contracts-upgradeable
[submodule "lib/transparent_upgradeable_beacon_proxy"]
path = lib/transparent_upgradeable_beacon_proxy
url = https://github.com/ltvprotocol/transparent_upgradeable_beacon_proxy
2 changes: 2 additions & 0 deletions deploy/mainnet/aave/SUSDE_USDT_X10_AAVEV3.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"LENDING_CONNECTOR_NAME": "AaveV3",
"BEACON_OWNER": "0xcf0475d9B0a29975bc5132A3066010eC898d8CaB",
"BEACON_PROXY_OWNER": "0xcf0475d9B0a29975bc5132A3066010eC898d8CaB",
"WHITELIST_OWNER": "0xcf0475d9B0a29975bc5132A3066010eC898d8CaB",
"NAME": "SUSDE/USDT x10 on Aave v3",
"SYMBOL": "SUSDE_USDT_X10_AAVEV3",
Expand Down Expand Up @@ -31,5 +32,6 @@
"SOFT_LIQUIDATION_LTV_DIVIDEND": 92,
"SOFT_LIQUIDATION_LTV_DIVIDER": 100,
"EMODE": 2,
"ACTIVATE_WHITELIST": true,
"WHITELIST_SIGNER": "0x0000000000000000000000000000000000000000"
}
1 change: 1 addition & 0 deletions deploy/mainnet/aave/WSTETH_WETH_x12_AAVEV3.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,6 @@
"SOFT_LIQUIDATION_LTV_DIVIDER": 100,
"EMODE": 1,
"WHITELIST_SIGNER": "0x0000000000000000000000000000000000000000",
"ACTIVATE_WHITELIST": true,
"DEPLOY_BEACON": true
}
4 changes: 3 additions & 1 deletion deploy/mainnet/morpho/weETH_WETH_x15_Morpho.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"LENDING_CONNECTOR_NAME": "Morpho",
"BEACON_OWNER": "0xcf0475d9B0a29975bc5132A3066010eC898d8CaB",
"BEACON_PROXY_OWNER": "0xcf0475d9B0a29975bc5132A3066010eC898d8CaB",
"WHITELIST_OWNER": "0xcf0475d9B0a29975bc5132A3066010eC898d8CaB",
"NAME": "weETH/WETH x15 on Morpho",
"SYMBOL": "weETH_WETH_x15_Morpho",
Expand Down Expand Up @@ -33,5 +34,6 @@
"LLTV": 945000000000000000,
"IRM": "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
"ORACLE": "0xbDd2F2D473E8D63d1BFb0185B5bDB8046ca48a72",
"WHITELIST_SIGNER": "0x0000000000000000000000000000000000000000"
"WHITELIST_SIGNER": "0x0000000000000000000000000000000000000000",
"ACTIVATE_WHITELIST": true
}
4 changes: 3 additions & 1 deletion deploy/mainnet/morpho/wstETH_WETH_x24_Morpho.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"LENDING_CONNECTOR_NAME": "Morpho",
"BEACON_OWNER": "0xcf0475d9B0a29975bc5132A3066010eC898d8CaB",
"BEACON_PROXY_OWNER": "0xcf0475d9B0a29975bc5132A3066010eC898d8CaB",
"WHITELIST_OWNER": "0xcf0475d9B0a29975bc5132A3066010eC898d8CaB",
"NAME": "wstETH/WETH x24 on Morpho",
"SYMBOL": "wstETH_WETH_x24_Morpho",
Expand Down Expand Up @@ -33,5 +34,6 @@
"LLTV": 965000000000000000,
"IRM": "0x870aC11D48B15DB9a138Cf899d20F13F79Ba00BC",
"ORACLE": "0xbD60A6770b27E084E8617335ddE769241B0e71D8",
"WHITELIST_SIGNER": "0x0000000000000000000000000000000000000000"
"WHITELIST_SIGNER": "0x0000000000000000000000000000000000000000",
"ACTIVATE_WHITELIST": true
}
1 change: 1 addition & 0 deletions deploy/sepolia/aave/kamikaze.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"LENDING_CONNECTOR_NAME": "AaveV3",
"BEACON_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"BEACON_PROXY_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"WHITELIST_OWNER": "0xdbd5bcfd943e7666fcd3585382ca808bef61c8ae",
"NAME": "weth/wbtc x4 on Aave v3 kamikaze",
"SYMBOL": "WETH_WBTC_x4_AAVEV3_KAMIKAZE",
Expand Down
1 change: 1 addition & 0 deletions deploy/sepolia/aave/permissioned.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"LENDING_CONNECTOR_NAME": "AaveV3",
"BEACON_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"BEACON_PROXY_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"WHITELIST_OWNER": "0xdbd5bcfd943e7666fcd3585382ca808bef61c8ae",
"NAME": "weth/wbtc x4 on Aave v3 permissioned",
"SYMBOL": "WETH_WBTC_x4_AAVEV3_PERMISSIONED",
Expand Down
3 changes: 2 additions & 1 deletion deploy/sepolia/aave/permissionless.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"LENDING_CONNECTOR_NAME": "AaveV3",
"BEACON_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"BEACON_PROXY_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"WHITELIST_OWNER": "0xdbd5bcfd943e7666fcd3585382ca808bef61c8ae",
"NAME": "weth/wbtc x4 on Aave v3",
"SYMBOL": "WETH_WBTC_x4_AAVEV3",
Expand Down Expand Up @@ -33,5 +34,5 @@
"WHITELIST_SIGNER": "0x6caf55c49fd07cc63d9acc108979c4c806246510",
"BEACON": "0xfE8f068568Cc84c3818406765da285e7f57B8A80",
"LTV_BEACON_PROXY": "0xAa707a2a0e38DE55cA0b61dd32468e357b55b15f",
"ACTIVATE_WHITELIST": true
"ACTIVATE_WHITELIST": false
}
38 changes: 38 additions & 0 deletions deploy/sepolia/aave/upgradeable_beacon_proxy.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
{
"LENDING_CONNECTOR_NAME": "AaveV3",
"BEACON_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"BEACON_PROXY_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"WHITELIST_OWNER": "0xdbd5bcfd943e7666fcd3585382ca808bef61c8ae",
"NAME": "weth/wbtc x4 on Aave v3 new beacon proxy",
"SYMBOL": "WETH_WBTC_x4_AAVEV3_NEW_BEACON_PROXY",
"COLLATERAL_ASSET": "0xc558dbdd856501fcd9aaf1e62eae57a9f0629a3c",
"BORROW_ASSET": "0x29f2D40B0605204364af54EC677bD022dA425d03",
"MAX_SAFE_LTV_DIVIDEND": 7,
"MAX_SAFE_LTV_DIVIDER": 9,
"MIN_PROFIT_LTV_DIVIDEND": 11,
"MIN_PROFIT_LTV_DIVIDER": 15,
"TARGET_LTV_DIVIDEND": 3,
"TARGET_LTV_DIVIDER": 4,
"MAX_GROWTH_FEE_DIVIDEND": 1,
"MAX_GROWTH_FEE_DIVIDER": 5,
"MAX_TOTAL_ASSETS_IN_UNDERLYING": 160000000000000000000000,
"BORROW_SLIPPAGE": 5000000000000000,
"COLLATERAL_SLIPPAGE": 5000000000000000,
"AUCTION_DURATION": 1024,
"MAX_DELEVERAGE_FEE_DIVIDEND": 1,
"MAX_DELEVERAGE_FEE_DIVIDER": 50,
"OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"GUARDIAN": "0xa90470360eab40447ffda22eb9bc4090f145e03d",
"GOVERNOR": "0x6e274b4f3be2431591477ab96607a2226e6ca043",
"EMERGENCY_DELEVERAGER": "0xdc8a33d04fc0742de2b8ba1b76e4f7541c6ca312",
"FEE_COLLECTOR": "0x39d43daa78ad3509733f25afea04facdf62ba0d6",
"EMODE": 0,
"SOFT_LIQUIDATION_FEE_DIVIDEND": 1,
"SOFT_LIQUIDATION_FEE_DIVIDER": 100,
"SOFT_LIQUIDATION_LTV_DIVIDEND": 92,
"SOFT_LIQUIDATION_LTV_DIVIDER": 100,
"WHITELIST_SIGNER": "0x6caf55c49fd07cc63d9acc108979c4c806246510",
"BEACON": "0xfE8f068568Cc84c3818406765da285e7f57B8A80",
"LTV_BEACON_PROXY": "0xAa707a2a0e38DE55cA0b61dd32468e357b55b15f",
"ACTIVATE_WHITELIST": false
}
1 change: 1 addition & 0 deletions deploy/sepolia/morpho/args.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"LENDING_CONNECTOR_NAME": "Morpho",
"BEACON_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"BEACON_PROXY_OWNER": "0xde1d9ff8d1396a98688d7e07eda88a19cf2bb6cf",
"WHITELIST_OWNER": "0xdbd5bcfd943e7666fcd3585382ca808bef61c8ae",
"NAME": "WETH/USDC x3 on Morpho",
"SYMBOL": "WETH_USDC_x3_Morpho",
Expand Down
9 changes: 8 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ src = "src"
out = "out"
libs = ["lib"]
optimizer=true
solc = "0.8.28"
evm_version = "prague"
bytecode_hash = "none"
cbor_metadata = false

# See more config options https://github.com/foundry-rs/foundry/blob/master/crates/config/README.md#all-options
ffi = true
Expand All @@ -12,4 +16,7 @@ extra_output = ["storageLayout"]
fs_permissions = [{ access = "read", path = "./script/ghost/data"}]

[invariant]
fail_on_revert=true
fail_on_revert=true

[lint]
lint_on_build = false
1 change: 1 addition & 0 deletions lib/transparent_upgradeable_beacon_proxy
17 changes: 13 additions & 4 deletions script/ltv_elements/DeployLTVBeaconProxy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,31 @@ import {ILTV} from "src/interfaces/ILTV.sol";
import {ILendingConnector} from "src/interfaces/connectors/ILendingConnector.sol";
import {IOracleConnector} from "src/interfaces/connectors/IOracleConnector.sol";
import {ISlippageConnector} from "src/interfaces/connectors/ISlippageConnector.sol";
import {BeaconProxy} from "openzeppelin-contracts/contracts/proxy/beacon/BeaconProxy.sol";
import {GetConnectorData} from "../utils/GetConnectorData.s.sol";
import {console} from "forge-std/console.sol";
import {TransparentUpgradeableBeaconProxy} from
"transparent_upgradeable_beacon_proxy/TransparentUpgradeableBeaconProxy.sol";

contract DeployLTVBeaconProxy is BaseScript, GetConnectorData {
function deploy() internal override {
address beacon = vm.envAddress("BEACON");
address beaconProxyOwner = vm.envAddress("BEACON_PROXY_OWNER");

BeaconProxy beaconProxy = new BeaconProxy{salt: bytes32(0)}(beacon, getInitializeFunctionCall());
TransparentUpgradeableBeaconProxy beaconProxy = new TransparentUpgradeableBeaconProxy{salt: bytes32(0)}(
beacon, beaconProxyOwner, getInitializeFunctionCall()
);
console.log("Beacon proxy deployed at: ", address(beaconProxy));
}

function hashedCreationCode() internal view override returns (bytes32) {
address beacon = vm.envAddress("BEACON");
return
keccak256(abi.encodePacked(type(BeaconProxy).creationCode, abi.encode(beacon, getInitializeFunctionCall())));
address beaconProxyOwner = vm.envAddress("BEACON_PROXY_OWNER");
return keccak256(
abi.encodePacked(
type(TransparentUpgradeableBeaconProxy).creationCode,
abi.encode(beacon, beaconProxyOwner, getInitializeFunctionCall())
)
);
}

function getInitializeFunctionCall() internal view returns (bytes memory) {
Expand Down