Skip to content

Commit

Permalink
fix(): arrow-vesting drives only on unclaimed; update examples with r…
Browse files Browse the repository at this point in the history
…elevant blocknumber
  • Loading branch information
bghughes committed Jan 10, 2024
1 parent 334dced commit a682a14
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
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

0 comments on commit a682a14

Please sign in to comment.