Skip to content

Commit

Permalink
fix: typecheck
Browse files Browse the repository at this point in the history
  • Loading branch information
tamtamchik committed Oct 10, 2024
1 parent 72a14c6 commit 71badc1
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
2 changes: 2 additions & 0 deletions lib/deploy.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { ContractFactory, ContractTransactionReceipt } from "ethers";
import { ethers } from "hardhat";

import { LidoLocator } from "typechain-types";

import { addContractHelperFields, DeployedContract, getContractPath, loadContract, LoadedContract } from "lib/contract";
import { ConvertibleToString, cy, gr, log, yl } from "lib/log";
import { incrementGasUsed, Sk, updateObjectInState } from "lib/state-file";
Expand Down
52 changes: 52 additions & 0 deletions test/0.8.9/contracts/AccountingOracle__MockForSanityChecker.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// SPDX-License-Identifier: UNLICENSED
// for testing purposes only
pragma solidity >=0.4.24 <0.9.0;

import {AccountingOracle, ILido} from "contracts/0.8.9/oracle/AccountingOracle.sol";

interface ITimeProvider {
function getTime() external view returns (uint256);
}

contract AccountingOracle__MockForSanityChecker {
address public immutable LIDO;
uint256 public immutable SECONDS_PER_SLOT;
uint256 public immutable GENESIS_TIME;

uint256 internal _lastRefSlot;

constructor(address lido, uint256 secondsPerSlot, uint256 genesisTime) {
LIDO = lido;
SECONDS_PER_SLOT = secondsPerSlot;
GENESIS_TIME = genesisTime;
}

function submitReportData(
AccountingOracle.ReportData calldata data,
uint256 /* contractVersion */
) external {
require(data.refSlot >= _lastRefSlot, "refSlot less than _lastRefSlot");
uint256 slotsElapsed = data.refSlot - _lastRefSlot;
_lastRefSlot = data.refSlot;

ILido(LIDO).handleOracleReport(
data.refSlot * SECONDS_PER_SLOT,
slotsElapsed * SECONDS_PER_SLOT,
data.numValidators,
data.clBalanceGwei * 1e9,
data.withdrawalVaultBalance,
data.elRewardsVaultBalance,
data.sharesRequestedToBurn,
data.withdrawalFinalizationBatches,
data.simulatedShareRate
);
}

function setLastProcessingRefSlot(uint256 refSlot) external {
_lastRefSlot = refSlot;
}

function getLastProcessingRefSlot() external view returns (uint256) {
return _lastRefSlot;
}
}

0 comments on commit 71badc1

Please sign in to comment.