Skip to content

Commit d6e80ba

Browse files
authored
Update deployment scripts (#16)
* modify deployment scripts * fix deployment scripts
1 parent f6d942e commit d6e80ba

File tree

3 files changed

+176
-171
lines changed

3 files changed

+176
-171
lines changed

script/DeployHelper.s.sol

Lines changed: 1 addition & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,7 @@ contract DeployHelper is Script {
4343
// 3. Verify Treasury configuration
4444
verifyTreasuryConfiguration();
4545

46-
// 4. Verify facet functionality
47-
verifyFacetFunctionality();
48-
49-
// 5. Verify contract linking
46+
// 4. Verify contract linking
5047
verifyContractLinking();
5148

5249
console.log("\nALL VERIFICATIONS PASSED!");
@@ -116,112 +113,6 @@ contract DeployHelper is Script {
116113
console.log("Treasury address linking verified");
117114
}
118115

119-
function verifyFacetFunctionality() internal {
120-
console.log("\n--- Facet Functionality Verification ---");
121-
122-
// Test AssetManagerAllocatorFacet
123-
testAssetManagerFacet();
124-
125-
// Test InsuranceBufferFacet
126-
testInsuranceBufferFacet();
127-
128-
// Test RewardDistributorFacet
129-
testProfitAndLossFacet();
130-
131-
console.log("All facet functionality verified");
132-
}
133-
134-
function testAssetManagerFacet() internal {
135-
console.log(" Testing AssetManagerAllocatorFacet...");
136-
137-
// Test maxLeverage function
138-
bytes memory maxLeverageData = abi.encodeWithSelector(bytes4(keccak256("maxLeverage()")));
139-
(bool success, bytes memory result) = address(treasury).call(maxLeverageData);
140-
require(success, "maxLeverage call failed");
141-
142-
uint256 maxLeverage = abi.decode(result, (uint256));
143-
console.log(" maxLeverage:", maxLeverage);
144-
145-
// Test netDeposits function - USDC is available on Scroll mainnet fork
146-
bytes memory netDepositsData = abi.encodeWithSelector(bytes4(keccak256("netDeposits()")));
147-
(success, result) = address(treasury).call(netDepositsData);
148-
require(success, "netDeposits call failed");
149-
150-
uint256 netDeposits = abi.decode(result, (uint256));
151-
console.log(" netDeposits:", netDeposits);
152-
153-
// Test checkMaxLeverage function
154-
bytes memory checkMaxLeverageData = abi.encodeWithSelector(
155-
bytes4(keccak256("checkMaxLeverage(uint256)")),
156-
1000000 // 1M USDC allocation
157-
);
158-
(success, result) = address(treasury).call(checkMaxLeverageData);
159-
require(success, "checkMaxLeverage call failed");
160-
161-
bool isWithinLimit = abi.decode(result, (bool));
162-
console.log(" checkMaxLeverage(1M):", isWithinLimit ? "within limit" : "exceeds limit");
163-
}
164-
165-
function testInsuranceBufferFacet() internal {
166-
console.log(" Testing InsuranceBufferFacet...");
167-
168-
// Test bufferTarget function
169-
bytes memory bufferTargetData = abi.encodeWithSelector(bytes4(keccak256("bufferTarget()")));
170-
(bool success, bytes memory result) = address(treasury).call(bufferTargetData);
171-
require(success, "bufferTarget call failed");
172-
173-
uint256 bufferTarget = abi.decode(result, (uint256));
174-
console.log(" bufferTarget:", bufferTarget);
175-
176-
// Test bufferRenewalRate function
177-
bytes memory bufferRenewalRateData = abi.encodeWithSelector(bytes4(keccak256("bufferRenewalRate()")));
178-
(success, result) = address(treasury).call(bufferRenewalRateData);
179-
require(success, "bufferRenewalRate call failed");
180-
181-
uint256 bufferRenewalRate = abi.decode(result, (uint256));
182-
console.log(" bufferRenewalRate:", bufferRenewalRate);
183-
184-
// Note: topUpBuffer and slashBuffer are internal functions that get called during other operations
185-
// They will be tested as part of the full flow in the actual test suite
186-
console.log(" topUpBuffer: internal function (tested in full flow)");
187-
console.log(" slashBuffer: internal function (tested in full flow)");
188-
}
189-
190-
function testProfitAndLossFacet() internal {
191-
console.log(" Testing RewardDistributorFacet...");
192-
193-
// Test successFee function
194-
bytes memory successFeeData = abi.encodeWithSelector(
195-
bytes4(keccak256("successFee(uint256)")),
196-
1000000 // 1M profit amount
197-
);
198-
(bool success, bytes memory result) = address(treasury).call(successFeeData);
199-
require(success, "successFee call failed");
200-
201-
uint256 successFee = abi.decode(result, (uint256));
202-
console.log(" successFee:", successFee);
203-
204-
// Test profitLatestEpoch function
205-
bytes memory profitLatestEpochData = abi.encodeWithSelector(bytes4(keccak256("profitLatestEpoch()")));
206-
(success, result) = address(treasury).call(profitLatestEpochData);
207-
require(success, "profitLatestEpoch call failed");
208-
209-
uint256 profitLatestEpoch = abi.decode(result, (uint256));
210-
console.log(" profitLatestEpoch:", profitLatestEpoch);
211-
212-
// Test profitPerBlock function
213-
bytes memory profitPerBlockData = abi.encodeWithSelector(bytes4(keccak256("profitPerBlock()")));
214-
(success, result) = address(treasury).call(profitPerBlockData);
215-
require(success, "profitPerBlock call failed");
216-
217-
uint256 profitPerBlock = abi.decode(result, (uint256));
218-
console.log(" profitPerBlock:", profitPerBlock);
219-
220-
// Note: assetManagerReport is a state-changing function that gets called during other operations
221-
// It will be tested as part of the full flow in the actual test suite
222-
console.log(" assetManagerReport: state-changing function (tested in full flow)");
223-
}
224-
225116
function verifyContractLinking() internal view {
226117
console.log("\n--- Contract Linking Verification ---");
227118

0 commit comments

Comments
 (0)