on master help sign in
release: use the actual available count for linear

but in the linear case we were still providing "total we could have withdrawn". This subtracts the amount withdrawn from the limit, resulting in the correct "available" count. Fixes #540.

commit531e1126fc073907c2929a6c6732e6ca3ad4879a authorfang <git@fang.io> dateThu 7 Jan 2021, 20:34 (6 years ago) parent683dae1
1 file changed+2−5
src/lib/starRelease.js+2−5
src/lib/starRelease.js+2−5
@@ -119,11 +119,8 @@ export async function getLinear(contracts, address) {
119119 const batch = await linearSR.getBatch(contracts, address);
120120 const { amount, withdrawn } = batch;
121121
122− // Contract errors on withdrawing from a user that does not have any
123− const available =
124− amount > 0
125− ? Math.min(await linearSR.getWithdrawLimit(contracts, address), remaining)
126− : 0;
122+ const limit = await linearSR.getWithdrawLimit(contracts, address);
123+ const available = Math.min(limit - withdrawn, remaining);
127124
128125 const total = Math.min(amount, remaining);
129126