Skip to content

Commit

Permalink
fix: medusa and signature
Browse files Browse the repository at this point in the history
  • Loading branch information
GalloDaSballo committed Oct 15, 2024
1 parent 0b72301 commit d60e671
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/utils/EncodingDecodingLib.sol
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
pragma solidity ^0.8.24;

library EncodingDecodingLib {
function encodeLQTYAllocation(uint88 _lqty, uint32 _averageTimestamp) public pure returns (uint224) {
function encodeLQTYAllocation(uint88 _lqty, uint32 _averageTimestamp) internal pure returns (uint224) {
uint224 _value = (uint224(_lqty) << 32) | _averageTimestamp;
return _value;
}

function decodeLQTYAllocation(uint224 _value) public pure returns (uint88, uint32) {
function decodeLQTYAllocation(uint224 _value) internal pure returns (uint88, uint32) {
return (uint88(_value >> 32), uint32(_value));
}
}
8 changes: 4 additions & 4 deletions test/recon/properties/BribeInitiativeProperties.sol
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ abstract contract BribeInitiativeProperties is BeforeAfter {
uint88 lusdPercentageOfBribe88 = uint88(lusdPercentageOfBribe >> 40);

// calculate user allocation percentage of total for this epoch
uint88 lqtyAllocatedByUserAtEpoch = IBribeInitiative(initiative).lqtyAllocatedByUserAtEpoch(user, currentEpoch);
uint88 totalLQTYAllocatedAtEpoch = IBribeInitiative(initiative).totalLQTYAllocatedByEpoch(currentEpoch);
(uint88 lqtyAllocatedByUserAtEpoch, ) = IBribeInitiative(initiative).lqtyAllocatedByUserAtEpoch(user, currentEpoch);
(uint88 totalLQTYAllocatedAtEpoch, ) = IBribeInitiative(initiative).totalLQTYAllocatedByEpoch(currentEpoch);
uint88 allocationPercentageOfTotal = (lqtyAllocatedByUserAtEpoch / totalLQTYAllocatedAtEpoch) * 10_000;

// check that allocation percentage and received bribe percentage match
Expand All @@ -45,7 +45,7 @@ abstract contract BribeInitiativeProperties is BeforeAfter {
uint16 currentEpoch = governance.epoch();
for(uint8 i; i < deployedInitiatives.length; i++) {
IBribeInitiative initiative = IBribeInitiative(deployedInitiatives[i]);
uint88 lqtyAllocatedByUserAtEpoch = initiative.lqtyAllocatedByUserAtEpoch(user, currentEpoch);
(uint88 lqtyAllocatedByUserAtEpoch, ) = initiative.lqtyAllocatedByUserAtEpoch(user, currentEpoch);
eq(ghostLqtyAllocationByUserAtEpoch[user], lqtyAllocatedByUserAtEpoch, "BI-03: Accounting for user allocation amount is always correct");
}
}
Expand All @@ -54,7 +54,7 @@ abstract contract BribeInitiativeProperties is BeforeAfter {
uint16 currentEpoch = governance.epoch();
for(uint8 i; i < deployedInitiatives.length; i++) {
IBribeInitiative initiative = IBribeInitiative(deployedInitiatives[i]);
uint88 totalLQTYAllocatedAtEpoch = initiative.totalLQTYAllocatedByEpoch(currentEpoch);
(uint88 totalLQTYAllocatedAtEpoch, ) = initiative.totalLQTYAllocatedByEpoch(currentEpoch);
eq(ghostTotalAllocationAtEpoch[currentEpoch], totalLQTYAllocatedAtEpoch, "BI-04: Accounting for total allocation amount is always correct");
}
}
Expand Down

0 comments on commit d60e671

Please sign in to comment.