on master help sign in
release: make "available" count consistent

Linear Release was treating it as "amount we can still withdraw", Conditional Release was treating it as "total we could have withdrawn". The former seems simpler to reason about, and is what the UI layer actually cares about, so we go with that. Fixes #532.

commitc29122b4e5cc37f7e13b0cdd83b5f2229e166677 authorfang <git@fang.io> dateThu 3 Dec 2020, 20:23 (6 years ago) parentf02a7f9
2 files changed+2−3
src/lib/starRelease.js+1−2 src/views/Release/Locked.js+1−1
src/lib/starRelease.js+1−2
@@ -108,8 +108,7 @@ export async function getConditional(contracts, address) {
108108 }
109109
110110 const withdrawnTotal = withdrawn.reduce((acc, val) => acc + val, 0);
111− const available =
112− batchLimits.reduce((acc, val) => acc + val, 0) + withdrawnTotal;
111+ const available = batchLimits.reduce((acc, val) => acc + val, 0);
113112
114113 return { total, available, withdrawn: withdrawnTotal, batchLimits };
115114}
src/views/Release/Locked.js+1−1
@@ -88,7 +88,7 @@ export default function Locked({ className, goActive }) {
8888 [construct, unconstruct]
8989 );
9090
91− const canWithdraw = starReleaseDetails.map(b => b.available - b.withdrawn);
91+ const canWithdraw = starReleaseDetails.map(b => b.available);
9292 const total = starReleaseDetails.map(b => b.total);
9393
9494 const validate = useMemo(