Skip to content

Commit 927340a

Browse files
authored
Leveraged Basis trade vault (#64)
1 parent ae6e384 commit 927340a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+3681
-1181
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,11 @@ broadcast/
1313
docs/
1414

1515
# Dotenv file
16-
.env
16+
../../socket/socket-plugs/.env
1717

1818
# IDE files
1919
.idea/
20+
.vscode/
2021

2122
lcov.info
2223

deployments/901/LBTCB.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"implementation": "0x499DFB45735907E2ea447006F66340709366f2aB",
3+
"token": "0x0Eb95740A626500f80E1652186E32416477880b5",
4+
"proxyAdmin": "0x02295856e96Ce40459adF38d66DfF6E43Ad94e6D"
5+
}

deployments/901/matching.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,7 @@
99
"transfer": "0x0CFC1a4a90741aB242cAfaCD798b409E12e68926",
1010
"withdrawal": "0xe850641C5207dc5E9423fB15f89ae6031A05fd92",
1111
"rfq": "0x4E4DD8Be1e461913D9A5DBC4B830e67a8694ebCa",
12-
"liquidate": "0xfC3d7465C6Aa57d7Ba39ed70F143F89E1f823f37"
12+
"liquidate": "0xfC3d7465C6Aa57d7Ba39ed70F143F89E1f823f37",
13+
"tsaShareHandler": "0x05bf05e4D19DaF3234d3aE287B32212924b551Fe",
14+
"atomicExecutor": "0x47E946f9027B0e7E0117afa482AF4C4053C53b40"
1315
}

deployments/901/weETHB.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"implementation": "0x6bF2f4896406d7f023245f3FAcbee9200E034D9f",
3+
"token": "0x9ffB0Ee4447c491E3c842b62184BB0669A12b9e4",
4+
"proxyAdmin": "0xed13a133ae5bf55de6e5e2f9908cdf298972c4ce"
5+
}

deployments/957/LBTCB.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"implementation": "0x377746e5d52141C9b3b20e2D86a7DB9453F7cc3e",
3+
"token": "0x2104654d6Da663961a86AC3Cf1751981C5dc62E8",
4+
"proxyAdmin": "0x880ed6BD35E07C0438d7Fb757a8c79c49ECab777"
5+
}

deployments/957/matching.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,7 @@
88
"transfer": "0x01259207A40925b794C8ac320456F7F6c8FE2636",
99
"withdrawal": "0x9d0E8f5b25384C7310CB8C6aE32C8fbeb645d083",
1010
"liquidate": "0x66d23e59DaEEF13904eFA2D4B8658aeD05f59a92",
11-
"rfq": "0x9371352CCef6f5b36EfDFE90942fFE622Ab77F1D"
11+
"rfq": "0x9371352CCef6f5b36EfDFE90942fFE622Ab77F1D",
12+
"tsaShareHandler": "0x4B759054CF4DA826e48645EfaDEfE9AfA613FDc5",
13+
"atomicExecutor": "0xE01557509EceFC07042226c9BF4cAC6Be25e0E2E"
1214
}

deployments/957/weETHB.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"implementation": "0x1886b148Fa52916820bE0Ce19c8e256835Bb8A7A",
3+
"token": "0x513Dc0e3407CA3A6E073A2f2d43fd61498db5739",
4+
"proxyAdmin": "0xE62aB0b9B84D21BE57beAEfcfF89aA08f47B0140"
5+
}

foundry.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ optimizer = true
66
optimizer_runs = 50
77
fs_permissions = [{access = "read-write", path = "./"}]
88

9-
solc_version="0.8.20"
9+
solc_version="0.8.27"
1010

1111
evm_version="shanghai"
1212

scripts/deploy-all.s.sol

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ import {SubAccountCreator} from "../src/periphery/SubAccountCreator.sol";
1313
import {LyraSettlementUtils} from "../src/periphery/LyraSettlementUtils.sol";
1414
import {LyraAuctionUtils} from "../src/periphery/LyraAuctionUtils.sol";
1515
import {DutchAuction} from "v2-core/src/liquidation/DutchAuction.sol";
16+
import {TSAShareHandler} from "../src/tokenizedSubaccounts/TSAShareHandler.sol";
17+
import {AtomicSigningExecutor} from "../src/AtomicSigningExecutor.sol";
1618
import {ISubAccounts} from "v2-core/src/interfaces/ISubAccounts.sol";
1719
import {IAsset} from "v2-core/src/interfaces/IAsset.sol";
1820
import {ICashAsset} from "v2-core/src/interfaces/ICashAsset.sol";
@@ -49,6 +51,9 @@ contract DeployAll is Utils {
4951

5052
deployment.matching = new Matching(ISubAccounts(config.subAccounts));
5153

54+
////
55+
// Modules
56+
5257
deployment.deposit = new DepositModule(deployment.matching);
5358
deployment.trade = new TradeModule(deployment.matching, IAsset(config.cash), defaultFeeRecipient);
5459
deployment.transfer = new TransferModule(deployment.matching);
@@ -64,21 +69,20 @@ contract DeployAll is Utils {
6469
deployment.matching.setAllowedModule(address(deployment.liquidate), true);
6570
deployment.matching.setAllowedModule(address(deployment.rfq), true);
6671

67-
deployment.matching.setTradeExecutor(0xf00A105BC009eA3a250024cbe1DCd0509c71C52b, true);
68-
69-
console2.log("subAccounts", address(config.subAccounts));
70-
console2.log("cash", address(config.cash));
71-
72-
deployment.subAccountCreator = new SubAccountCreator(ISubAccounts(config.subAccounts), deployment.matching);
73-
console2.log("subAccountCreator: ", address(deployment.subAccountCreator));
72+
/////
73+
// helpers
7474

7575
deployment.settlementUtil = new LyraSettlementUtils();
76-
console2.log("settlementUtil: ", address(deployment.settlementUtil));
77-
76+
deployment.subAccountCreator = new SubAccountCreator(ISubAccounts(config.subAccounts), deployment.matching);
7877
deployment.auctionUtil = new LyraAuctionUtils(
7978
ISubAccounts(config.subAccounts), DutchAuction(config.auction), config.srm
8079
);
81-
console2.log("settlementUtil: ", address(deployment.settlementUtil));
80+
deployment.tsaShareHandler = new TSAShareHandler();
81+
deployment.atomicSigningExecutor = new AtomicSigningExecutor(deployment.matching);
82+
83+
// whitelist helpers
84+
deployment.matching.setTradeExecutor(0xf00A105BC009eA3a250024cbe1DCd0509c71C52b, true);
85+
deployment.matching.setTradeExecutor(address(deployment.atomicSigningExecutor), true);
8286

8387
// write to output
8488
__writeToDeploymentsJson(deployment);
@@ -102,6 +106,8 @@ contract DeployAll is Utils {
102106
vm.serializeAddress(objKey, "auctionUtil", address(deployment.auctionUtil));
103107
vm.serializeAddress(objKey, "liquidate", address(deployment.liquidate));
104108
vm.serializeAddress(objKey, "rfq", address(deployment.rfq));
109+
vm.serializeAddress(objKey, "tsaShareHandler", address(deployment.tsaShareHandler));
110+
vm.serializeAddress(objKey, "atomicSigningExecutor", address(deployment.atomicSigningExecutor));
105111

106112
string memory finalObj = vm.serializeAddress(objKey, "withdrawal", address(deployment.withdrawal));
107113

scripts/deploy-and-dump.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@ cp lib/v2-core/deployments/$chainId/strands.json deployments/$chainId/strands.js
4747
cp lib/v2-core/deployments/$chainId/SFP.json deployments/$chainId/SFP.json
4848
cp lib/v2-core/deployments/$chainId/SOL.json deployments/$chainId/SOL.json
4949
cp lib/v2-core/deployments/$chainId/DOGE.json deployments/$chainId/DOGE.json
50-
cp lib/v2-core/scripts/input/$chainId/config.json deployments/$chainId/shared.json
51-
50+
cp lib/v2-core/deployments/$chainId/shared.json deployments/$chainId/shared.json
5251

52+
echo "Deployed core contracts"
5353

5454
# Deploy matching contracts
5555
forge script scripts/deploy-all.s.sol --rpc-url $ETH_RPC_URL --broadcast
@@ -59,6 +59,7 @@ MARKET_NAME=SOL forge script scripts/add-perp-to-modules.s.sol --rpc-url $ETH_RP
5959
MARKET_NAME=DOGE forge script scripts/add-perp-to-modules.s.sol --rpc-url $ETH_RPC_URL --broadcast
6060

6161
forge script scripts/deploy-tsa.s.sol --rpc-url $ETH_RPC_URL --broadcast
62+
DEPOSIT_ASSET=WSTETH PERP_ASSET=ETH forge script scripts/deploy-lbtsa.s.sol --rpc-url $ETH_RPC_URL --broadcast
6263

6364
if [[ "$ETH_RPC_URL" =~ .*local.* ]]; then
6465
forge script scripts/update-callees.s.sol --rpc-url $ETH_RPC_URL --broadcast

0 commit comments

Comments
 (0)