-
Notifications
You must be signed in to change notification settings - Fork 0
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
8 changed files
with
69 additions
and
43 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -20,53 +20,57 @@ import {Script} from "lib/forge-std/src/Script.sol"; | |
/// @title Kwenta KSX deployment script | ||
/// @author Flocqst ([email protected]) | ||
contract Setup is Script { | ||
|
||
function deploySystem( | ||
address token, | ||
address pDAO | ||
) public returns (KSXVault ksxVault) { | ||
ksxVault = new KSXVault({ | ||
_token: token, | ||
_pDAO: pDAO | ||
}); | ||
) | ||
public | ||
returns (KSXVault ksxVault) | ||
{ | ||
ksxVault = new KSXVault({_token: token, _pDAO: pDAO}); | ||
|
||
// deploy ERC1967 proxy and set implementation to ksxVault | ||
Proxy proxy = new Proxy(address(ksxVault), ""); | ||
|
||
// "wrap" proxy in IKSXVault interface | ||
ksxVault = KSXVault(address(proxy)); | ||
} | ||
|
||
} | ||
|
||
/// @dev steps to deploy and verify on Optimism: | ||
/// (1) load the variables in the .env file via `source .env` | ||
/// (2) run `forge script script/Deploy.s.sol:DeployOptimism --rpc-url $OPTIMISM_RPC_URL --etherscan-api-key $OPTIMISM_ETHERSCAN_API_KEY --broadcast --verify -vvvv` | ||
/// (2) run `forge script script/Deploy.s.sol:DeployOptimism --rpc-url | ||
/// $OPTIMISM_RPC_URL --etherscan-api-key $OPTIMISM_ETHERSCAN_API_KEY | ||
/// --broadcast --verify -vvvv` | ||
contract DeployOptimism is Setup, OptimismParameters { | ||
|
||
function run() public { | ||
uint256 privateKey = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(privateKey); | ||
|
||
Setup.deploySystem({ | ||
token: KWENTA, | ||
pDAO: PDAO | ||
}); | ||
Setup.deploySystem({token: KWENTA, pDAO: PDAO}); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
|
||
} | ||
|
||
/// @dev steps to deploy and verify on Optimism Goerli: | ||
/// (1) load the variables in the .env file via `source .env` | ||
/// (2) run `forge script script/Deploy.s.sol:DeployOptimismGoerli --rpc-url $OPTIMISM_GOERLI_RPC_URL --etherscan-api-key $OPTIMISM_ETHERSCAN_API_KEY --broadcast --verify -vvvv` | ||
/// (2) run `forge script script/Deploy.s.sol:DeployOptimismGoerli --rpc-url | ||
/// $OPTIMISM_GOERLI_RPC_URL --etherscan-api-key $OPTIMISM_ETHERSCAN_API_KEY | ||
/// --broadcast --verify -vvvv` | ||
contract DeployOptimismGoerli is Setup, OptimismGoerliParameters { | ||
|
||
function run() public { | ||
uint256 privateKey = vm.envUint("PRIVATE_KEY"); | ||
vm.startBroadcast(privateKey); | ||
|
||
Setup.deploySystem({ | ||
token: KWENTA, | ||
pDAO: PDAO | ||
}); | ||
Setup.deploySystem({token: KWENTA, pDAO: PDAO}); | ||
|
||
vm.stopBroadcast(); | ||
} | ||
|
||
} |
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
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,17 +1,18 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.25; | ||
|
||
import {IKSXVault} from "src/interfaces/IKSXVault.sol"; | ||
import {ERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
import {ERC4626} from | ||
"@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol"; | ||
import {ERC20, IERC20} from "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
import {IKSXVault} from "src/interfaces/IKSXVault.sol"; | ||
|
||
import "@openzeppelin/contracts/proxy/utils/UUPSUpgradeable.sol"; | ||
|
||
/// @title KSXVault Contract | ||
/// @notice KSX ERC4626 Vault | ||
/// @author Flocqst ([email protected]) | ||
contract KSXVault is IKSXVault, ERC4626, UUPSUpgradeable { | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
IMMUTABLES | ||
//////////////////////////////////////////////////////////////*/ | ||
|
@@ -32,7 +33,10 @@ contract KSXVault is IKSXVault, ERC4626, UUPSUpgradeable { | |
/// @param _token Kwenta token address | ||
/// @param _pDAO Kwenta owned/operated multisig address | ||
/// that can authorize upgrades | ||
constructor(address _token, address _pDAO) | ||
constructor( | ||
address _token, | ||
address _pDAO | ||
) | ||
ERC4626(IERC20(_token)) | ||
ERC20("KSX Vault", "KSX") | ||
{ | ||
|
@@ -54,4 +58,5 @@ contract KSXVault is IKSXVault, ERC4626, UUPSUpgradeable { | |
if (pDAO == address(0)) revert NonUpgradeable(); | ||
if (msg.sender != pDAO) revert OnlyPDAO(); | ||
} | ||
|
||
} |
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 |
---|---|---|
|
@@ -7,6 +7,7 @@ import "@openzeppelin/contracts/token/ERC20/extensions/ERC4626.sol"; | |
/// @title Kwenta KSXVault Interface | ||
/// @author Flocqst ([email protected]) | ||
interface IKSXVault { | ||
|
||
/*////////////////////////////////////////////////////////////// | ||
ERRORS | ||
//////////////////////////////////////////////////////////////*/ | ||
|
@@ -20,4 +21,5 @@ interface IKSXVault { | |
/// @dev the KSXVault is not upgradeable when | ||
/// the pDAO has been set to the zero address | ||
error NonUpgradeable(); | ||
|
||
} |
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
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 |
---|---|---|
|
@@ -6,11 +6,11 @@ import {KSXVault} from "src/KSXVault.sol"; | |
/// @title Example upgraded Vault contract for testing purposes | ||
/// @author Flocqst ([email protected]) | ||
contract MockVaultUpgrade is KSXVault { | ||
constructor(address _token, address _pDAO) | ||
KSXVault(_token, _pDAO) | ||
{} | ||
|
||
constructor(address _token, address _pDAO) KSXVault(_token, _pDAO) {} | ||
|
||
function echo(string memory message) public pure returns (string memory) { | ||
return message; | ||
} | ||
|
||
} |