Skip to content

Commit

Permalink
merge resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
CarsonCase committed Sep 6, 2024
2 parents c15a117 + 884446f commit 4f54ce6
Show file tree
Hide file tree
Showing 9 changed files with 377 additions and 23 deletions.
57 changes: 57 additions & 0 deletions deployment-config/form-lst-testnet-l1-08-30-24.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"base": "0xee44150250AfF3E6aC25539765F056EDb7F85D7B",
"protocolAdmin": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"boringVaultAndBaseDecimals": "18",
"boringVault": {
"boringVaultSalt": "0x1ddd634c506ad203da17ff000000000000000000000000000000000000000013",
"boringVaultName": "Form LST",
"boringVaultSymbol": "FLST",
"address": "0x0000000000000000000000000000000000000000"
},
"manager": {
"managerSalt": "0x30432d4b4ec00003b4a250000000000000000000000000000000000000000013",
"address": "0x0000000000000000000000000000000000000000"
},
"accountant": {
"accountantSalt": "0x6a184dbea6f3cc0318679f000000000000000000000000000000000000000013",
"payoutAddress": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"allowedExchangeRateChangeUpper": "10003",
"allowedExchangeRateChangeLower": "9998",
"minimumUpdateDelayInSeconds": "3600",
"managementFee": "0",
"address": "0x0000000000000000000000000000000000000000"
},
"teller": {
"tellerSalt": "0x51f8968749a56d01202c91000000000000000000000000000000000000000013",
"maxGasForPeer": 100000,
"minGasForPeer": 0,
"peerEid": 40270,
"tellerContractName": "TellerWithMultiAssetSupport",
"opMessenger": "0x58Cc85b8D04EA49cC6DBd3CbFFd00B4B8D6cb3ef",
"assets": [],
"dvnIfNoDefault": {
"required": [
"0x589dEDbD617e0CBcB916A9223F4d1300c294236b"
],
"optional": [
"0x380275805876Ff19055EA900CDb2B46a94ecF20D",
"0x8FafAE7Dd957044088b3d0F67359C327c6200d18",
"0xa59BA433ac34D2927232918Ef5B2eaAfcF130BA5",
"0xe552485d02EDd3067FE7FCbD4dd56BB1D3A998D2"
],
"blockConfirmationsRequiredIfNoDefault": 15,
"optionalThreshold": 1
},
"address": "0x0000000000000000000000000000000000000000"
},
"rolesAuthority": {
"rolesAuthoritySalt": "0x66bbc3b3b3000b01466a3a000000000000000000000000000000000000000013",
"strategist": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"exchangeRateBot": "0x0000000000417626Ef34D62C4DC189b021603f2F",
"address": "0x0000000000000000000000000000000000000000"
},
"decoder": {
"decoderSalt": "0x48b53893da2e0b0248268c000000000000000000000000000000000000000013",
"address": "0x0000000000000000000000000000000000000000"
}
}
4 changes: 2 additions & 2 deletions lzConfigCheck.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function assert(statement, message){
async function main() {
const args = process.argv.slice(2);

if (args.length < 2) {
if (args.length != 2) {
console.error("Usage: node script.js <file1Name> <file2Name>");
process.exit(1);
}
Expand All @@ -113,7 +113,7 @@ async function main() {

const chain2 = findings2.findings[0].chain;
for (const finding of findings2.findings) {
assert(providers1.includes(finding.provider), "Provider: "+finding.provider+" does not havea matching provider in the first config");
assert(providers1.includes(finding.provider), "Provider: "+finding.provider+" does not have a matching provider in the first config");
assert(finding.chain == chain2, "Networks do not match for: "+finding);
}

Expand Down
4 changes: 2 additions & 2 deletions script/Base.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ abstract contract BaseScript is Script {
string constant CONFIG_CHAIN_ROOT = "./deployment-config/chains/";

/// Custom base params
// Address for Sepolia
ICreateX CREATEX = ICreateX(0x1C64d5eBCf22AC237d00cF7bB9Be6395e59B23b7);
ICreateX immutable CREATEX;

/// @dev Included to enable compilation of the script without a $MNEMONIC environment variable.
string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk";
Expand All @@ -44,6 +43,7 @@ abstract contract BaseScript is Script {
///
/// The use case for $ETH_FROM is to specify the broadcaster key and its address via the command line.
constructor() {
CREATEX = ICreateX(vm.envAddress("CREATEX"));
deployCreate2 = vm.envOr({ name: "CREATE2", defaultValue: true });
address from = vm.envOr({ name: "ETH_FROM", defaultValue: address(0) });
if (from != address(0)) {
Expand Down
3 changes: 2 additions & 1 deletion script/DeployCustomCreatex.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ contract DeployCustomCreateX is Script {
string internal mnemonic;
string internal constant TEST_MNEMONIC = "test test test test test test test test test test test junk";

address constant EXPECTED = 0x1C64d5eBCf22AC237d00cF7bB9Be6395e59B23b7;
address immutable EXPECTED;
bytes32 constant SALT = 0x8888888833388888888000000000000000000000000000000000000000000000;

constructor() {
EXPECTED = vm.envAddress("CREATEX");
address from = vm.envOr({ name: "ETH_FROM", defaultValue: address(0) });
if (from != address(0)) {
broadcaster = from;
Expand Down
10 changes: 5 additions & 5 deletions script/deploy/01_DeployRateProviders.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ contract DeployRateProviders is BaseScript {
using StdJson for string;
using Strings for address;

function run(string memory fileName, string memory configFileName, bool ignoreExisting) public {
function run(string memory fileName, string memory configFileName) public {
string memory path = string.concat(CONFIG_PATH_ROOT, configFileName);
string memory config = vm.readFile(path);
_run(fileName, config, ignoreExisting);
_run(fileName, config);
}

function run() public {
string memory config = requestConfigFileFromUser();
_run(Strings.toString(block.chainid), config, false);
_run(Strings.toString(block.chainid), config);
}

function _run(string memory fileName, string memory config, bool ignoreExisting) internal {
function _run(string memory fileName, string memory config) internal {
string memory chainConfig = getChainConfigFile();

address[] memory assets = config.readAddressArray(".teller.assets");
Expand All @@ -39,7 +39,7 @@ contract DeployRateProviders is BaseScript {
string(abi.encodePacked(".assetToRateProviderAndPriceFeed.", assets[i].toHexString(), ".rateProvider"));
address rateProvider = chainConfig.readAddress(rateProviderKey);
// must deploy new rate provider and set the value
if (ignoreExisting || rateProvider == address(0)) {
if (rateProvider == address(0)) {
address priceFeed = chainConfig.readAddress(
string(abi.encodePacked(".assetToRateProviderAndPriceFeed.", assets[i].toHexString(), ".priceFeed"))
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ contract DeployMultiChainLayerZeroTellerWithMultiAssetSupport is BaseScript {
AccountantWithRateProviders(teller.accountant()).vault() == teller.vault(),
"the accountant vault must be the teller vault"
);
require(address(endpoint) == config.lzEndpoint, "OP Teller must have messenger set");
require(address(endpoint) == config.lzEndpoint, "LZ Teller must have endpoint set");

// get the default libraries for the peer
address sendLib = endpoint.defaultSendLibrary(config.peerEid);
Expand Down
2 changes: 1 addition & 1 deletion src/base/Roles/AccountantWithRateProviders.sol
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ contract AccountantWithRateProviders is Auth, IRateProvider {
} else {
uint256 quoteRate = data.rateProvider.getRate();
uint256 oneQuote = 10 ** quoteDecimals;
rateInQuote = oneQuote.mulDivDown((exchangeRateInQuoteDecimals), quoteRate);
rateInQuote = oneQuote.mulDivDown(exchangeRateInQuoteDecimals, quoteRate);
}
}
}
Expand Down
20 changes: 9 additions & 11 deletions test/LiveDeploy.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { MultiChainLayerZeroTellerWithMultiAssetSupport } from
"src/base/Roles/CrossChain/MultiChainLayerZeroTellerWithMultiAssetSupport.sol";

string constant DEFAULT_RPC_URL = "L1_RPC_URL";
uint256 constant DELTA = 10_000;

// We use this so that we can use the inheritance linearization to start the fork before other constructors
abstract contract ForkTest is Test {
Expand Down Expand Up @@ -68,9 +69,6 @@ contract LiveDeploy is ForkTest, DeployAll {
FILE_NAME = vm.envString("LIVE_DEPLOY_READ_FILE_NAME");
}

// todo - include deploying rate providers IF not already deployed on this chain
// (new DeployRateProviders()).run("liveDeploy.json", FILE_NAME, true);

// Run the deployment scripts

run(FILE_NAME);
Expand Down Expand Up @@ -204,8 +202,6 @@ contract LiveDeploy is ForkTest, DeployAll {
);
}

uint256 constant DELTA = 10_000;

function testDepositASupportedAssetAndUpdateRate(uint256 depositAmount, uint96 rateChange) public {
uint256 assetsCount = mainConfig.assets.length;
AccountantWithRateProviders accountant = AccountantWithRateProviders(mainConfig.accountant);
Expand Down Expand Up @@ -304,19 +300,21 @@ contract LiveDeploy is ForkTest, DeployAll {
}
}

function testAssetsAreAllNormalERC20() public {
function testAssetsAreAllNormalERC20(uint256 mintAmount, uint256 transferAmount) public {
mintAmount = bound(mintAmount, 1, type(uint256).max);
transferAmount = bound(transferAmount, 1, mintAmount);
address user1 = makeAddr("user1");
address user2 = makeAddr("user2");

for (uint256 i; i < mainConfig.assets.length; ++i) {
ERC20 asset = ERC20(mainConfig.assets[i]);
deal(address(asset), user1, 1 ether);
assertEq(asset.balanceOf(user1), 1 ether, "asset did not deal to user1 correctly");
deal(address(asset), user1, mintAmount);
assertEq(asset.balanceOf(user1), mintAmount, "asset did not deal to user1 correctly");
uint256 totalSupplyStart = asset.totalSupply();
vm.prank(user1);
asset.transfer(user2, 0.5 ether);
assertEq(asset.balanceOf(user1), 0.5 ether, "user1 balance not removed after transfer");
assertEq(asset.balanceOf(user2), 0.5 ether, "user2 balance not incremented after transfer");
asset.transfer(user2, transferAmount);
assertEq(asset.balanceOf(user1), mintAmount - transferAmount, "user1 balance not removed after transfer");
assertEq(asset.balanceOf(user2), transferAmount, "user2 balance not incremented after transfer");
}
}

Expand Down
Loading

0 comments on commit 4f54ce6

Please sign in to comment.