Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[arrow-vesting] Update Arrow-Vesting strategy to only count vested, unclaimed tokens #1388

Merged
merged 2 commits into from
Jan 23, 2024
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
5 changes: 3 additions & 2 deletions src/strategies/arrow-vesting/examples.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@
"0xB66f08DBd7A59B32e98033b9A1da08B5793DAb79",
"0x5b8eD2A2CfFCD474B2E688fdeA21CB5c4350E575",
"0x03b5Dc2CE78a7bEe9F66DD619b291595a2E166BB",
"0x06A61f56de8c6a2735D1Dea68340D201ddEd7348"
"0x06A61f56de8c6a2735D1Dea68340D201ddEd7348",
"0x252C855Cc3aB5f48229393Bc4DA129542a08C808"
],
"snapshot": 18879362
"snapshot": 112192500
}
]
20 changes: 10 additions & 10 deletions src/strategies/arrow-vesting/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ const vestingContractAbi = [
'function recipient() public view returns (address)',
'function total_locked() public view returns (uint256)',
'function start_time() public view returns (uint256)',
'function end_time() public view returns (uint256)'
'function unclaimed() public view returns (uint256)'
// don't need to check initialized?
// don't need to check admin?
// don't need to check future_admin?
];

export async function strategy(
Expand Down Expand Up @@ -82,9 +85,9 @@ export async function strategy(
[]
);
vestingContractMulti.call(
`${vestingContractAddress}.end_time`,
`${vestingContractAddress}.unclaimed`,
vestingContractAddress,
'end_time',
'unclaimed',
[]
);
});
Expand All @@ -106,15 +109,12 @@ export async function strategy(
const start = params['start_time'];

if (recipient in addressBalances && time > start) {
const locked = parseFloat(
formatUnits(params['total_locked'], options.decimals)
const unclaimedTokens = parseFloat(
formatUnits(params['unclaimed'], options.decimals)
);
const end = params['end_time'];

addressBalances[recipient] += Math.min(
(locked * (time - start)) / (end - start),
locked
);
// Vested arrow that can be claimed is all that is counted in this strategy
addressBalances[recipient] += unclaimedTokens;
}
});

Expand Down
Loading