forked from m0-foundation/protocol
-
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.
Merge pull request m0-foundation#160 from MZero-Labs/feat/deploy-scri…
…pt-fix feat: Deploy script fix
- Loading branch information
Showing
16 changed files
with
363 additions
and
309 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
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,7 +6,8 @@ | |
"author": "M^0 Labs <[email protected]>", | ||
"license": "GPL-3.0", | ||
"scripts": { | ||
"coverage": "forge coverage --no-match-path 'test/invariant/**/*.sol' --report lcov && lcov --extract lcov.info -o lcov.info 'src/*' && genhtml lcov.info -o coverage", | ||
"coverage": "make -B coverage", | ||
"coverage-summary": "make -B coverage-summary", | ||
"doc": "forge doc --serve --port 4000", | ||
"prettier": "prettier --write --plugin=prettier-plugin-solidity 'script/**/*.sol' 'src/**/*.sol' 'test/**/*.sol'", | ||
"slither": "forge build --build-info --skip '*/test/**' --skip '*/script/**' --force && slither --compile-force-framework foundry --ignore-compile --config-file slither.config.json --fail-high .", | ||
|
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 was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
|
||
pragma solidity 0.8.23; | ||
|
||
import { ContractHelper } from "../lib/common/src/ContractHelper.sol"; | ||
|
||
import { MinterGateway } from "../src/MinterGateway.sol"; | ||
import { MToken } from "../src/MToken.sol"; | ||
import { StableEarnerRateModel } from "../src/rateModels/StableEarnerRateModel.sol"; | ||
import { MinterRateModel } from "../src/rateModels/MinterRateModel.sol"; | ||
|
||
contract DeployBase { | ||
/** | ||
* @dev Deploys TTG. | ||
* @param deployer_ The address of the account deploying the contracts. | ||
* @param deployerNonce_ The current nonce of the deployer. | ||
* @param ttgRegistrar_ The address of the TTG Registrar. | ||
* @return minterGateway_ The address of the deployed Minter Gateway. | ||
* @return minterRateModel_ The address of the deployed Minter Rate Model. | ||
* @return earnerRateModel_ The address of the deployed Earner Rate Model. | ||
*/ | ||
function deploy( | ||
address deployer_, | ||
uint256 deployerNonce_, | ||
address ttgRegistrar_ | ||
) public virtual returns (address minterGateway_, address minterRateModel_, address earnerRateModel_) { | ||
// M token needs `minterGateway_` and `ttgRegistrar_` addresses. | ||
// MinterGateway needs `ttgRegistrar_` and M token addresses and for `ttgRegistrar_` to be deployed. | ||
// EarnerRateModel needs `minterGateway_` address and for `minterGateway_` to be deployed. | ||
// MinterRateModel needs `ttgRegistrar_` address. | ||
|
||
address mToken_ = address(new MToken(ttgRegistrar_, getExpectedMinterGateway(deployer_, deployerNonce_))); | ||
|
||
minterGateway_ = address(new MinterGateway(ttgRegistrar_, mToken_)); | ||
minterRateModel_ = address(new MinterRateModel(ttgRegistrar_)); | ||
earnerRateModel_ = address(new StableEarnerRateModel(minterGateway_)); | ||
} | ||
|
||
function getExpectedMToken(address deployer_, uint256 deployerNonce_) public pure virtual returns (address) { | ||
return ContractHelper.getContractFrom(deployer_, deployerNonce_); | ||
} | ||
|
||
function getExpectedMinterGateway(address deployer_, uint256 deployerNonce_) public pure virtual returns (address) { | ||
return ContractHelper.getContractFrom(deployer_, deployerNonce_ + 1); | ||
} | ||
|
||
function getExpectedMinterRateModel( | ||
address deployer_, | ||
uint256 deployerNonce_ | ||
) public pure virtual returns (address) { | ||
return ContractHelper.getContractFrom(deployer_, deployerNonce_ + 2); | ||
} | ||
|
||
function getExpectedEarnerRateModel( | ||
address deployer_, | ||
uint256 deployerNonce_ | ||
) public pure virtual returns (address) { | ||
return ContractHelper.getContractFrom(deployer_, deployerNonce_ + 3); | ||
} | ||
|
||
function getDeployerNonceAfterProtocolDeployment(uint256 deployerNonce_) public pure virtual returns (uint256) { | ||
return deployerNonce_ + 4; | ||
} | ||
} |
Oops, something went wrong.