Skip to content

Commit 347e22c

Browse files
authored
feat(stake): show the claim-lock instead of a button that reverts (#271)
* fix(ui): scroll clearance under the sticky nav, balanced source tiles - html gets scroll-padding-top: 5rem (64px sticky DaoHeader + breathing room), so anchor jumps and scrollIntoView land clear of the nav site-wide instead of leaving headings clipped behind its blur. - The source tiles' column count now derives from the source count so rows stay balanced: 5 sources render 3+2 instead of 4+1 with an orphan; 6 (a future Seaport source) becomes 3+3. The formula and its composition table are documented in place, including why auto-fit was rejected — it trades a reproducible orphan for an intermittent one. * feat(stake): show the claim-lock instead of a button that reverts usersData already carried claimLockEnd (the power lock chosen at stake time) and the position hook already read it as morUnlockAt — nothing consumed it. The lootbox offered a Claim button for locked MOR that the contract would revert until the lock lifts; one user has 0.2007 MOR locked to 2028-07-28 behind what looked like a working button. Reward pools now split by the lock: unlocked ones keep the button, locked ones render as a dashed row with 'MOR locked until {date}' and no button. Locked MOR still counts as a reason to surface the chest — it is the user's money; it just cannot pretend to be claimable.
1 parent 1dc8bb1 commit 347e22c

4 files changed

Lines changed: 202 additions & 43 deletions

File tree

messages/en/stake.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@
189189
"morphoTitle": "Morpho yield",
190190
"claimYield": "Harvest",
191191
"vaultClaimed": "Yield harvested to your wallet",
192-
"enableRewards": "Enable rewards"
192+
"enableRewards": "Enable rewards",
193+
"claimLocked": "MOR locked until {date}"
193194
},
194195
"admin": {
195196
"title": "Sponsorship vaults",

messages/pt-br/stake.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,8 @@
189189
"morphoTitle": "Yield Morpho",
190190
"claimYield": "Colher",
191191
"vaultClaimed": "Yield colhido na carteira",
192-
"enableRewards": "Ativar recompensas"
192+
"enableRewards": "Ativar recompensas",
193+
"claimLocked": "MOR travado até {date}"
193194
},
194195
"admin": {
195196
"title": "Cofres de patrocínio",

src/components/stake/MorLootbox.tsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,16 +175,24 @@ export function MorLootbox({
175175
const collectable = collectItems.reduce((s, x) => s + x.amount, 0);
176176

177177
const pools = position?.pools ?? [];
178-
const claimable = pools.filter(
178+
// Split by the claim-lock, not filtered out by it: locked MOR is still the
179+
// user's money and still a reason to open the box — it just must not wear a
180+
// Claim button that the contract will revert until claimLockEnd. One user
181+
// already has 0.2 MOR locked to 2028 behind what looked like a working
182+
// button.
183+
const rewardable = pools.filter(
179184
(p) => p.pendingMor > LOOT_MIN_MOR && p.referrer && p.referrer.toLowerCase() !== ZERO,
180185
);
186+
const claimable = rewardable.filter((p) => p.morUnlockAt <= nowSec);
187+
const claimLocked = rewardable.filter((p) => p.morUnlockAt > nowSec);
181188
const distributable = pools.filter((p) => (splitBalances[p.asset] ?? 0) > LOOT_MIN_MOR);
182189
const stakedPools = pools.filter((p) => p.staked > 0);
183190
// The box surfaces whenever there's anything to act on — MOR rewards (claim,
184191
// distribute, collect), Morpho vault yield to harvest, OR a principal position
185192
// to manage (7-day lock).
186193
const hasAction =
187194
claimable.length > 0 ||
195+
claimLocked.length > 0 ||
188196
distributable.length > 0 ||
189197
collectable > LOOT_MIN_MOR ||
190198
vaultRewards.length > 0 ||
@@ -313,6 +321,7 @@ export function MorLootbox({
313321
{open && (
314322
<RewardClaimModal
315323
claimable={claimable}
324+
claimLocked={claimLocked}
316325
distributable={distributable}
317326
collectable={collectable}
318327
vaultRewards={vaultRewards}

0 commit comments

Comments
 (0)