Skip to content

Commit

Permalink
Merge pull request #3 from BalancerMaxis/fix_full_schedule
Browse files Browse the repository at this point in the history
Fix full schedule
  • Loading branch information
Hyferion authored Aug 7, 2024
2 parents 046ef8b + c09d413 commit 49c5f43
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
12 changes: 8 additions & 4 deletions contracts/ChildChainGaugeInjectorV2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -355,9 +355,13 @@ KeeperCompatibleInterface
/**
* @notice Gets all current schedule information as a set of arrays
*/
function getFullSchedule() public view returns (address[] memory gauges, uint256[] memory amountsPerPeriod, uint8[] memory maxPeriods, uint56[] memory lastTimestamps, uint56[] memory doNotStartBeforeTimestamps) {
gauges = getActiveGaugeList();
function getFullSchedule() public view returns (address[] memory, uint256[] memory, uint8[] memory, uint56[] memory, uint56[] memory) {
address[] memory gauges = getActiveGaugeList();
uint len = gauges.length;
uint256[] memory amountsPerPeriod = new uint256[](len);
uint8[] memory maxPeriods = new uint8[](len);
uint56[] memory lastTimestamps = new uint56[](len);
uint56[] memory doNotStartBeforeTimestamps = new uint56[](len);

for (uint256 i = 0; i < gauges.length; i++) {
Target memory target = GaugeConfigs[gauges[i]];
Expand Down Expand Up @@ -486,9 +490,9 @@ KeeperCompatibleInterface
/**
* @notice Return a list of active gauges
*/
function getActiveGaugeList() public view returns (address[] memory activeGauges) {
function getActiveGaugeList() public view returns (address[] memory) {
uint256 len = ActiveGauges.length();
activeGauges = new address[](len);
address[] memory activeGauges = new address[](len);
for (uint256 i = 0; i < len; i++) {
activeGauges[i] = ActiveGauges.at(i);
}
Expand Down
9 changes: 9 additions & 0 deletions test/ChildChainGaugeInjectorV2.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ describe('ChildChainGaugeInjector', () => {
expect(upkeepNeeded).to.equal(true);
});

it.only("should get the full schedule with recipients", async function () {
const weeklyIncentive = BigInt("200000000000000000000");

await injector.addRecipients([gauge, gauge2], weeklyIncentive, 2, 0);

await injector.getFullSchedule();
});

it("should work with a long delay", async function () {
const tokenAddress = await token.getAddress();
const gaugeAddress = await gauge.getAddress();
Expand Down Expand Up @@ -393,6 +401,7 @@ describe('ChildChainGaugeInjector', () => {
expect(rewardData.distributor).to.equal(await injector.owner());
});


it('should set and retrieve keeper registry address correctly', async () => {
const newKeeperAddress = await addr1.getAddress();
await injector.setKeeperAddresses([newKeeperAddress]);
Expand Down

0 comments on commit 49c5f43

Please sign in to comment.