Skip to content

Commit

Permalink
Add last seen event data (#22)
Browse files Browse the repository at this point in the history
* add last seen event data

* change to updated and add test
  • Loading branch information
hexonaut authored Jul 30, 2024
1 parent c8af6cb commit 2228ded
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/forwarders/DSROracleForwarderBase.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { IPot } from '../interfaces/IPot.sol';
*/
abstract contract DSROracleForwarderBase {

event LastSeenPotDataUpdated(IDSROracle.PotData potData);

IPot public immutable pot;
address public immutable l2Oracle;

Expand All @@ -27,6 +29,7 @@ abstract contract DSROracleForwarderBase {
rho: uint40(pot.rho())
});
_lastSeenPotData = potData;
emit LastSeenPotDataUpdated(potData);
return abi.encodeCall(
IDSRAuthOracle.setPotData,
(potData)
Expand Down
8 changes: 8 additions & 0 deletions test/DSROracleXChainIntegrationBase.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ interface IPotDripLike {

abstract contract DSROracleXChainIntegrationBaseTest is Test {

event LastSeenPotDataUpdated(IDSROracle.PotData potData);

using DomainHelpers for *;

uint256 constant CURR_DSR = 1.000000001547125957863212448e27;
Expand Down Expand Up @@ -81,6 +83,12 @@ abstract contract DSROracleXChainIntegrationBaseTest is Test {
assertEq(forwarder.getLastSeenChi(), 0);
assertEq(forwarder.getLastSeenRho(), 0);

vm.expectEmit(address(forwarder));
emit LastSeenPotDataUpdated(IDSROracle.PotData({
dsr: uint96(CURR_DSR),
chi: uint120(CURR_CHI),
rho: uint40(CURR_RHO)
}));
doRefresh();

data = forwarder.getLastSeenPotData();
Expand Down

0 comments on commit 2228ded

Please sign in to comment.