Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test and chore: more test files #151

Merged
merged 2 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .solcover.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
module.exports = {
skipFiles: [
"staking/test/BridgeRelayer.sol",
"staking/test/MockDepositProcessorL1.sol",
"staking/test/MockStakingDispenser.sol",
"staking/test/MockStakingFactory.sol",
"staking/test/MockStakingProxy.sol",
Expand Down
File renamed without changes.
File renamed without changes.
48 changes: 48 additions & 0 deletions contracts/staking/test/MockDepositProcessorL1.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.25;

import {DefaultDepositProcessorL1, IToken} from "../DefaultDepositProcessorL1.sol";

contract MockDepositProcessorL1 is DefaultDepositProcessorL1 {
address public constant MOCK_ADDRESS = address(1);

/// @dev MockDepositProcessorL1 constructor.
/// @param _olas OLAS token address.
/// @param _l1Dispenser L1 tokenomics dispenser address.
constructor(
address _olas,
address _l1Dispenser
) DefaultDepositProcessorL1(_olas, _l1Dispenser, MOCK_ADDRESS, MOCK_ADDRESS, 1) {}

/// @inheritdoc DefaultDepositProcessorL1
function _sendMessage(
address[] memory targets,
uint256[] memory stakingIncentives,
bytes memory,
uint256 transferAmount
) internal override returns (uint256 sequence) {

bytes memory data;

// Transfer OLAS together with message, or just a message
if (transferAmount > 0) {
// Approve tokens for the bridge contract
IToken(olas).approve(l1TokenRelayer, transferAmount);

data = abi.encode(targets, stakingIncentives);
} else {
// Assemble AMB data payload
data = abi.encodeWithSelector(RECEIVE_MESSAGE, abi.encode(targets, stakingIncentives));
}

sequence = stakingBatchNonce;
emit MessagePosted(sequence, targets, stakingIncentives, transferAmount);
}

/// @dev Process message received from L2.
/// @param data Bytes message data sent from L2.
function receiveMessage(bytes memory data) external {
// Process the data
_receiveMessage(MOCK_ADDRESS, MOCK_ADDRESS, data);
}
}
2 changes: 1 addition & 1 deletion scripts/deployment/deploy_02_tokenomics.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async function main() {
}

// Writing updated parameters back to the JSON file
parsedData.tokenomicsTwoAddress = tokenomics.address;
parsedData.tokenomicsThreeAddress = tokenomics.address;
fs.writeFileSync(globalsFile, JSON.stringify(parsedData));

// Contract verification
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const main = async () => {
await tx.wait();

// tx back: https://sepolia-optimism.etherscan.io/tx/0x6ef9bb50e9a70077ddb00d978b0baf93e3ba17e5f36a3978b225e97f7b613884
// tx result: https://sepolia.etherscan.io/tx/0xeb19c818e408115f3a284afe2bba33e8272d28636c9540e5a861a9db2d60cdfb

// https://docs.optimism.io/builders/app-developers/tutorials/cross-dom-solidity#interact-with-the-l2-greeter
// https://github.com/t4sk/notes/tree/main/op
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ async function main() {
// Get all the necessary contract addresses
const governorTwoAddress = parsedData.governorTwoAddress;
const tokenomicsProxyAddress = parsedData.tokenomicsProxyAddress;
const tokenomicsTwoAddress = parsedData.tokenomicsTwoAddress;
const tokenomicsThreeAddress = parsedData.tokenomicsThreeAddress;

// Get the GovernorOLAS instance via its ABI
const GovernorOLASJSON = "abis/aux/GovernorOLAS.json";
const GovernorOLASJSON = "abis/misc/GovernorOLAS.json";
let contractFromJSON = fs.readFileSync(GovernorOLASJSON, "utf8");
let contract = JSON.parse(contractFromJSON);
const GovernorOLASABI = contract["abi"];
Expand All @@ -43,8 +43,8 @@ async function main() {
console.log("Proposal 1. TokenomicsProxy to change Tokenomics implementation calling `changeTokenomicsImplementation(TokenomicsTwo)`");
const targets = [tokenomicsProxyAddress];
const values = [0];
const callDatas = [tokenomicsProxy.interface.encodeFunctionData("changeTokenomicsImplementation", [tokenomicsTwoAddress])];
const description = "Change Tokenomics implementation to the version 1.0.1";
const callDatas = [tokenomicsProxy.interface.encodeFunctionData("changeTokenomicsImplementation", [tokenomicsThreeAddress])];
const description = "Change Tokenomics implementation to the version 1.2.0";

// Proposal details
console.log("targets:", targets);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ async function main() {

// Swap contract tracking
const vaultAddress = parsedData.vaultAddress;
const vaultJSON = "abis/aux/Vault.json";
const vaultJSON = "abis/misc/Vault.json";
const contractFromJSON = fs.readFileSync(vaultJSON, "utf8");
const abi = JSON.parse(contractFromJSON);
const vault = await ethers.getContractAt(abi, vaultAddress);
Expand Down
Loading