-
Notifications
You must be signed in to change notification settings - Fork 193
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #549 from lidofinance/feature/plain-coverage
Feat: new accounting oracle report for Lido (feature/shapella-upgrade)
- Loading branch information
Showing
94 changed files
with
2,950 additions
and
3,106 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// SPDX-FileCopyrightText: 2023 Lido <[email protected]> | ||
|
||
// SPDX-License-Identifier: MIT | ||
|
||
// See contracts/COMPILERS.md | ||
pragma solidity 0.4.24; | ||
|
||
library SafeMathSigned256 { | ||
function add(int256 a, int256 b) internal pure returns (int256 c) { | ||
c = a + b; | ||
|
||
if (a > 0 && b > 0 && c < 0) { | ||
revert ("MATH_SIGNED_OVERFLOW"); | ||
} else if (a < 0 && b < 0 && c > 0) { | ||
revert ("MATH_SIGNED_UNDERFLOW"); | ||
} | ||
} | ||
|
||
function sub(int256 a, int256 b) internal pure returns (int256 c) { | ||
// a - b = a + (-b) | ||
c = add(a, -b); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,28 @@ | ||
// SPDX-FileCopyrightText: 2023 Lido <[email protected]> | ||
// SPDX-License-Identifier: GPL-3.0 | ||
pragma solidity 0.8.9; | ||
pragma solidity 0.4.24; | ||
|
||
import { ILegacyOracle } from "../../oracle/AccountingOracle.sol"; | ||
|
||
interface ILegacyOracle { | ||
function getBeaconSpec() external view returns ( | ||
uint64 epochsPerFrame, | ||
uint64 slotsPerEpoch, | ||
uint64 secondsPerSlot, | ||
uint64 genesisTime | ||
); | ||
|
||
contract MockLegacyOracle is ILegacyOracle { | ||
function getLastCompletedEpochId() external view returns (uint256); | ||
} | ||
|
||
import "../oracle/LidoOracle.sol"; | ||
|
||
contract MockLegacyOracle is ILegacyOracle, LidoOracle { | ||
uint64 internal _epochsPerFrame; | ||
uint64 internal _slotsPerEpoch; | ||
uint64 internal _secondsPerSlot; | ||
uint64 internal _genesisTime; | ||
uint256 internal _lastCompletedEpochId; | ||
|
||
constructor( | ||
uint64 epochsPerFrame, | ||
uint64 slotsPerEpoch, | ||
uint64 secondsPerSlot, | ||
uint64 genesisTime, | ||
uint256 lastCompletedEpochId | ||
) { | ||
_epochsPerFrame = epochsPerFrame; | ||
_slotsPerEpoch = slotsPerEpoch; | ||
_secondsPerSlot = secondsPerSlot; | ||
_genesisTime = genesisTime; | ||
_lastCompletedEpochId = lastCompletedEpochId; | ||
} | ||
|
||
function getBeaconSpec() external view returns ( | ||
uint64 epochsPerFrame, | ||
|
@@ -40,6 +38,21 @@ contract MockLegacyOracle is ILegacyOracle { | |
); | ||
} | ||
|
||
|
||
function setParams( | ||
uint64 epochsPerFrame, | ||
uint64 slotsPerEpoch, | ||
uint64 secondsPerSlot, | ||
uint64 genesisTime, | ||
uint256 lastCompletedEpochId | ||
) external { | ||
_epochsPerFrame = epochsPerFrame; | ||
_slotsPerEpoch = slotsPerEpoch; | ||
_secondsPerSlot = secondsPerSlot; | ||
_genesisTime = genesisTime; | ||
_lastCompletedEpochId = lastCompletedEpochId; | ||
|
||
} | ||
function getLastCompletedEpochId() external view returns (uint256) { | ||
return _lastCompletedEpochId; | ||
} | ||
|
Oops, something went wrong.