Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions lib/contracts/abis/mainnet/CarrotVesting.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,13 @@ export const CarrotVesting = <const>[
outputs: [{ type: 'uint32', name: '', simpleType: 'uint' }],
inputs: [],
},
{
type: 'function',
name: 'getNewDuration',
stateMutability: 'view',
outputs: [{ internalType: 'uint32', name: '', type: 'uint32' }],
inputs: [],
},
{
type: 'function',
name: 'startVesting',
Expand All @@ -82,6 +89,20 @@ export const CarrotVesting = <const>[
outputs: [{ type: 'uint32', name: '', simpleType: 'uint' }],
inputs: [],
},
{
inputs: [],
name: 'getNewSteps',
outputs: [{ internalType: 'uint32', name: '', type: 'uint32' }],
stateMutability: 'view',
type: 'function',
},
{
inputs: [],
name: 'getUpgradeTimestamp',
outputs: [{ internalType: 'uint48', name: '', type: 'uint48' }],
stateMutability: 'view',
type: 'function',
},
{
type: 'function',
name: 'EXCHANGE_RATE',
Expand Down
24 changes: 24 additions & 0 deletions lib/contracts/handlers/__tests__/carrot-vesting-handler.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,4 +207,28 @@ describe('CarrotVestingHandler', () => {
const result = await handler.getDuration();
expect(result).toBe(duration);
});

it('should get the new duration of the vesting period', async () => {
const newDuration = 365;
contractTestingUtils.mockCall('getNewDuration', [newDuration]);

const result = await handler.getNewDuration();
expect(result).toBe(newDuration);
});

it('should get the new steps of the vesting period', async () => {
const newSteps = 10;
contractTestingUtils.mockCall('getNewSteps', [newSteps]);

const result = await handler.getNewSteps();
expect(result).toBe(newSteps);
});

it('should get the upgrade timestamp', async () => {
const upgradeTimestamp = 1234567890;
contractTestingUtils.mockCall('getUpgradeTimestamp', [upgradeTimestamp]);

const result = await handler.getUpgradeTimestamp();
expect(result).toBe(upgradeTimestamp);
});
});
30 changes: 30 additions & 0 deletions lib/contracts/handlers/carrot-vesting-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,4 +231,34 @@ export class CarrotVestingHandler {
public getDuration() {
return this.getContract().read.getDuration();
}

/**
* Get the new duration of the vesting period. This is a new function
* added after contract upgrade.
*
* @returns The new duration of the vesting period.
*/
public getNewDuration() {
return this.getContract().read.getNewDuration();
}

/**
* Get the upgrade timestamp. This is a new function added after
* contract upgrade.
*
* @returns The upgrade timestamp.
*/
public getNewSteps() {
return this.getContract().read.getNewSteps();
}

/**
* Get the upgrade timestamp. This is a new function added after
* contract upgrade.
*
* @returns The upgrade timestamp.
*/
public getUpgradeTimestamp() {
return this.getContract().read.getUpgradeTimestamp();
}
}