-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
4,365 additions
and
1,200 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"Account": "0xf9CC1eD5EC9b8DFb9273fdDABD07C7bB37938285", | ||
"Events": "0xa7AE3969A128048290968b41865Eaa53B20FA69e", | ||
"Account": "0x0fCeF9608B9F7a8C57D53B98E78fA64b4D786a9F", | ||
"Events": "0xe32F27B27F4ea5f10f269b52223910bA83e2933C", | ||
"Factory": "0x30582eeE34719fe22b1B6c3b607636A3ab94522E", | ||
"Settings": "0xd2f3c4D549EF6AB572dB6512AB0e33f709E7caE1" | ||
"Settings": "0x8B9CbD3da94c637c0652c680Abd3CF7f787aBAF4" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"Account": "0x3BC8D34314E77c2E36948Fd8F4B353f1baDc3F6C", | ||
"Events": "0x11193470df30B37Af9fc5Ec696c240D878bdfb42", | ||
"Account": "0x83E13069aA457778ca349E0128927B417A2c2B3f", | ||
"Events": "0xB753d2EE5dcA1fF39A83CA3Ec500656c31Be940b", | ||
"Factory": "0x8234F990b149Ae59416dc260305E565e5DAfEb54", | ||
"Settings": "0xD02813baF080d06FC6F706cF93F5DaA96D6edB17" | ||
"Settings": "0x865dA103d126b3Be3599D84caB57109A861F5631" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,39 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity 0.8.18; | ||
|
||
import "forge-std/Script.sol"; | ||
import "./utils/parameters/OptimismGoerliParameters.sol"; | ||
import "./utils/parameters/OptimismParameters.sol"; | ||
import {Script} from "lib/forge-std/src/Script.sol"; | ||
|
||
import {IAddressResolver} from "script/utils/interfaces/IAddressResolver.sol"; | ||
|
||
import {Account} from "src/Account.sol"; | ||
import {Events} from "src/Events.sol"; | ||
import {Factory} from "src/Factory.sol"; | ||
import {IAddressResolver} from "./utils/interfaces/IAddressResolver.sol"; | ||
import {IAccount} from "src/interfaces/IAccount.sol"; | ||
import {Settings} from "src/Settings.sol"; | ||
|
||
import { | ||
OPTIMISM_DEPLOYER, | ||
OPTIMISM_PDAO, | ||
OPTIMISM_SYNTHETIX_ADDRESS_RESOLVER, | ||
OPTIMISM_GELATO, | ||
OPTIMISM_OPS, | ||
OPTIMISM_UNISWAP_UNIVERSAL_ROUTER, | ||
OPTIMISM_UNISWAP_PERMIT2, | ||
PROXY_SUSD, | ||
PERPS_V2_EXCHANGE_RATE, | ||
FUTURES_MARKET_MANAGER, | ||
SYSTEM_STATUS | ||
} from "script/utils/parameters/OptimismParameters.sol"; | ||
import { | ||
OPTIMISM_GOERLI_DEPLOYER, | ||
OPTIMISM_GOERLI_KWENTA_ADMIN_DAO_MULTI_SIG, | ||
OPTIMISM_GOERLI_SYNTHETIX_ADDRESS_RESOLVER, | ||
OPTIMISM_GOERLI_GELATO, | ||
OPTIMISM_GOERLI_OPS, | ||
OPTIMISM_GOERLI_UNISWAP_UNIVERSAL_ROUTER, | ||
OPTIMISM_GOERLI_UNISWAP_PERMIT2 | ||
} from "script/utils/parameters/OptimismGoerliParameters.sol"; | ||
|
||
/// @title Script to deploy Kwenta's Smart Margin Account Factory | ||
/// @author JaredBorders ([email protected]) | ||
contract Setup { | ||
|
@@ -18,7 +42,9 @@ contract Setup { | |
address _owner, | ||
address _addressResolver, | ||
address _gelato, | ||
address _ops | ||
address _ops, | ||
address _universalRouter, | ||
address _permit2 | ||
) | ||
public | ||
returns ( | ||
|
@@ -28,40 +54,51 @@ contract Setup { | |
Account implementation | ||
) | ||
{ | ||
IAddressResolver addressResolver; | ||
|
||
// define *initial* factory owner | ||
address temporaryOwner = | ||
_deployer == address(0) ? address(this) : _deployer; | ||
|
||
// deploy the factory | ||
factory = new Factory({ | ||
_owner: temporaryOwner | ||
}); | ||
_owner: temporaryOwner | ||
}); | ||
|
||
// deploy the events contract and set the factory | ||
events = new Events({ | ||
_factory: address(factory) | ||
}); | ||
_factory: address(factory) | ||
}); | ||
|
||
// deploy the settings contract | ||
settings = new Settings({ | ||
_owner: _owner | ||
}); | ||
_owner: _owner | ||
}); | ||
|
||
// resolve necessary addresses via the Synthetix Address Resolver | ||
IAddressResolver addressResolver = IAddressResolver(_addressResolver); | ||
|
||
implementation = new Account({ | ||
_factory: address(factory), | ||
_events: address(events), | ||
_marginAsset: addressResolver.getAddress({name: PROXY_SUSD}), | ||
_perpsV2ExchangeRate: addressResolver.getAddress({name: PERPS_V2_EXCHANGE_RATE}), | ||
_futuresMarketManager: addressResolver.getAddress({name: FUTURES_MARKET_MANAGER}), | ||
_systemStatus: addressResolver.getAddress({name: SYSTEM_STATUS}), | ||
_gelato: _gelato, | ||
_ops: _ops, | ||
_settings: address(settings) | ||
addressResolver = IAddressResolver(_addressResolver); | ||
|
||
IAccount.AccountConstructorParams memory params = IAccount | ||
.AccountConstructorParams({ | ||
factory: address(factory), | ||
events: address(events), | ||
marginAsset: addressResolver.getAddress({name: PROXY_SUSD}), | ||
perpsV2ExchangeRate: addressResolver.getAddress({ | ||
name: PERPS_V2_EXCHANGE_RATE | ||
}), | ||
futuresMarketManager: addressResolver.getAddress({ | ||
name: FUTURES_MARKET_MANAGER | ||
}), | ||
systemStatus: addressResolver.getAddress({name: SYSTEM_STATUS}), | ||
gelato: _gelato, | ||
ops: _ops, | ||
settings: address(settings), | ||
universalRouter: _universalRouter, | ||
permit2: _permit2 | ||
}); | ||
|
||
implementation = new Account(params); | ||
|
||
// update the factory with the new account implementation | ||
factory.upgradeAccountImplementation({ | ||
_implementation: address(implementation) | ||
|
@@ -82,10 +119,12 @@ contract DeployOptimism is Script, Setup { | |
|
||
Setup.deploySystem({ | ||
_deployer: OPTIMISM_DEPLOYER, | ||
_owner: OPTIMISM_KWENTA_ADMIN_DAO_MULTI_SIG, | ||
_owner: OPTIMISM_PDAO, | ||
_addressResolver: OPTIMISM_SYNTHETIX_ADDRESS_RESOLVER, | ||
_gelato: OPTIMISM_GELATO, | ||
_ops: OPTIMISM_OPS | ||
_ops: OPTIMISM_OPS, | ||
_universalRouter: OPTIMISM_UNISWAP_UNIVERSAL_ROUTER, | ||
_permit2: OPTIMISM_UNISWAP_PERMIT2 | ||
}); | ||
|
||
vm.stopBroadcast(); | ||
|
@@ -105,7 +144,9 @@ contract DeployOptimismGoerli is Script, Setup { | |
_owner: OPTIMISM_GOERLI_KWENTA_ADMIN_DAO_MULTI_SIG, | ||
_addressResolver: OPTIMISM_GOERLI_SYNTHETIX_ADDRESS_RESOLVER, | ||
_gelato: OPTIMISM_GOERLI_GELATO, | ||
_ops: OPTIMISM_GOERLI_OPS | ||
_ops: OPTIMISM_GOERLI_OPS, | ||
_universalRouter: OPTIMISM_GOERLI_UNISWAP_UNIVERSAL_ROUTER, | ||
_permit2: OPTIMISM_GOERLI_UNISWAP_PERMIT2 | ||
}); | ||
|
||
vm.stopBroadcast(); | ||
|
Oops, something went wrong.