diff --git a/.solcover.js b/.solcover.js index d331d6a9..727d6948 100644 --- a/.solcover.js +++ b/.solcover.js @@ -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", diff --git a/abis/aux/GovernorOLAS.json b/abis/misc/GovernorOLAS.json similarity index 100% rename from abis/aux/GovernorOLAS.json rename to abis/misc/GovernorOLAS.json diff --git a/abis/aux/Vault.json b/abis/misc/Vault.json similarity index 100% rename from abis/aux/Vault.json rename to abis/misc/Vault.json diff --git a/contracts/staking/test/MockDepositProcessorL1.sol b/contracts/staking/test/MockDepositProcessorL1.sol new file mode 100644 index 00000000..b55dd603 --- /dev/null +++ b/contracts/staking/test/MockDepositProcessorL1.sol @@ -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); + } +} \ No newline at end of file diff --git a/scripts/deployment/deploy_02_tokenomics.js b/scripts/deployment/deploy_02_tokenomics.js index f4f3338a..80db89d5 100644 --- a/scripts/deployment/deploy_02_tokenomics.js +++ b/scripts/deployment/deploy_02_tokenomics.js @@ -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 diff --git a/scripts/deployment/staking/optimistic/send_tokens_and_message.js b/scripts/deployment/staking/optimistic/send_tokens_and_message.js index 12933d35..a58f268a 100644 --- a/scripts/deployment/staking/optimistic/send_tokens_and_message.js +++ b/scripts/deployment/staking/optimistic/send_tokens_and_message.js @@ -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 diff --git a/scripts/proposals/proposal_01_change_tokenomics_implementation.js b/scripts/proposals/proposal_01_change_tokenomics_implementation.js index c6a2890b..83128e8a 100644 --- a/scripts/proposals/proposal_01_change_tokenomics_implementation.js +++ b/scripts/proposals/proposal_01_change_tokenomics_implementation.js @@ -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"]; @@ -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); diff --git a/scripts/proposals/proposal_08_calculate_LP_OLAS_WXDAI_balancer.js b/scripts/proposals/proposal_08_calculate_LP_OLAS_WXDAI_balancer.js index 88bfc199..91763038 100644 --- a/scripts/proposals/proposal_08_calculate_LP_OLAS_WXDAI_balancer.js +++ b/scripts/proposals/proposal_08_calculate_LP_OLAS_WXDAI_balancer.js @@ -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);