Skip to content

Commit

Permalink
feat: add deploy stkGHO script (#3)
Browse files Browse the repository at this point in the history
* feat: add deploy stkGHO script

* Fixed script comment and name() on stkGHO

* Update scripts/StkGHO.s.sol

Co-authored-by: Lukas <[email protected]>

* Reverted previous permit() name param

* fix: use proxy factory

---------

Co-authored-by: eboado <[email protected]>
  • Loading branch information
sakulstra and eboadom authored Mar 4, 2024
1 parent e6530c1 commit b0fe903
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 2 deletions.
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/aave-token-v3"]
path = lib/aave-token-v3
url = https://github.com/bgd-labs/aave-token-v3
[submodule "lib/aave-helpers"]
path = lib/aave-helpers
url = https://github.com/bgd-labs/aave-helpers
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ update:; forge update
build :; forge build --sizes
test :; forge test -vvv

# Deploy
deploy-ledger :; forge script ${contract} --rpc-url ${chain} $(if ${dry},--sender 0x25F2226B597E8F9514B3F68F00f494cF4f286491 -vvvv,--broadcast --ledger --mnemonics foo --mnemonic-indexes ${MNEMONIC_INDEX} --sender ${LEDGER_SENDER} --verify -vvvv --slow)
deploy-pk :; forge script ${contract} --rpc-url ${chain} $(if ${dry},--sender 0x25F2226B597E8F9514B3F68F00f494cF4f286491 -vvvv,--broadcast --private-key ${PRIVATE_KEY} --verify -vvvv --slow)

# Utilities
download :; cast etherscan-source --chain ${chain} -d src/etherscan/${chain}_${address} ${address}
git-diff :
Expand Down
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ libs = ['lib']
remappings = [
]
fs_permissions = [{ access = "write", path = "./reports" }]
solc_version = '0.8.22'

[fuzz]
runs = 10000
Expand Down
1 change: 1 addition & 0 deletions lib/aave-helpers
Submodule aave-helpers added at 6cc788
7 changes: 5 additions & 2 deletions remappings.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ etherscan/stkAAVE:aave-token-v3/=etherscan/stkAAVE/StakedAaveV3/lib/aave-token-v
etherscan/stkAAVE:openzeppelin-contracts/=etherscan/stkAAVE/StakedAaveV3/lib/openzeppelin-contracts

ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/
forge-std/=lib/aave-helpers/lib/forge-std/src/
openzeppelin-contracts/=lib/openzeppelin-contracts/
aave-token-v3/=lib/aave-token-v3/src/
aave-token-v3/=lib/aave-token-v3/src/
aave-helpers/=lib/aave-helpers/src/
aave-address-book/=lib/aave-helpers/lib/aave-address-book/src
solidity-utils/=lib/aave-helpers/lib/solidity-utils/src
45 changes: 45 additions & 0 deletions scripts/StkGHO.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;

import {StakeToken} from '../src/contracts/StakeToken.sol';
import {GovernanceV3Ethereum} from 'aave-address-book/GovernanceV3Ethereum.sol';
import {MiscEthereum} from 'aave-address-book/MiscEthereum.sol';
import {AaveV3EthereumAssets} from 'aave-address-book/AaveV3Ethereum.sol';
import {EthereumScript} from 'aave-helpers/ScriptUtils.sol';
import {IERC20} from 'openzeppelin-contracts/contracts/token/ERC20/IERC20.sol';
import {ITransparentProxyFactory} from 'solidity-utils/contracts/transparent-proxy/interfaces/ITransparentProxyFactory.sol';

/**
* @dev Deploy Ethereum
* deploy-command: make deploy-ledger contract=scripts/StkGHO.s.sol:DeployStkGHO chain=mainnet
* verify-command: npx catapulta-verify -b broadcast/StkGHO.s.sol/1/run-latest.json
* Params from https://snapshot.org/#/aave.eth/proposal/0x4bc99a842adab6cdd8c7d5c7a787ee4c0056be554fde0d008d53b45b3e795065
* - 100% slashing is technically not possible without breaking the stk exchangeRate, therfore maxSlashing is set to 99%
*/
contract DeployStkGHO is EthereumScript {
function run() external broadcast {
// StakeToken stkTokenImpl = new StakeToken(
// 'stkGHO',
// IERC20(AaveV3EthereumAssets.GHO_UNDERLYING),
// IERC20(AaveV3EthereumAssets.AAVE_UNDERLYING),
// 2 days,
// MiscEthereum.ECOSYSTEM_RESERVE,
// GovernanceV3Ethereum.EXECUTOR_LVL_1
// );
StakeToken stkTokenImpl = StakeToken(0x50F9d4E28309303F0cdcAc8AF0b569e8b75Ab857);
ITransparentProxyFactory(MiscEthereum.TRANSPARENT_PROXY_FACTORY).create(
address(stkTokenImpl),
address(MiscEthereum.PROXY_ADMIN),
abi.encodeWithSelector(
StakeToken.initialize.selector,
'stk GHO',
'stkGHO',
GovernanceV3Ethereum.EXECUTOR_LVL_1,
GovernanceV3Ethereum.EXECUTOR_LVL_1,
GovernanceV3Ethereum.EXECUTOR_LVL_1,
9900, // 99 %
20 days
)
);
}
}

0 comments on commit b0fe903

Please sign in to comment.