Repository navigation
feat(cards): SavingsFacility pays out swept shares in cash - #58
Conversation
👁️ Cyclops Security Review✅ Reviewed 4907d05 (latest) · Coverage: partial ·
|
| (address to, uint128 swept) = CARDS.payoutOf(owner, SHARE, address(this)); | ||
| if (to == address(0)) revert ZeroAddress(); | ||
| uint256 done = paidOut[owner]; | ||
| if (swept <= done) revert NothingToSettle(); | ||
| shares = swept - done; | ||
| paidOut[owner] = swept; | ||
| // As in `settle`: priced by the vault's quote, and redeemed for at least what is paid. | ||
| assets = VAULT.previewRedeem(shares); | ||
| _redeem(shares, assets); | ||
| SafeTransferLib.safeTransfer(ASSET, to, assets); |
There was a problem hiding this comment.
Needs review: SavingsFacility.payOut pays earlier sweeps' shares to the record's latest recipient
payOut reads one recipient from the card records precompile at call time and pays it the whole unpaid delta against a high-water mark keyed by owner alone. If a later sweep of the same owner names a different recipient, the earlier recipient's unpaid shares are paid to the later one. Whether TIP-1169 permits that recipient change is not established.
Valid? React with 👍 / 👎.
Adds
SavingsFacility.payOut(owner): when a card-records sweep (TIP-1169escheatwith aviafacility) pays an account's Earn shares into the facility, anyone can callpayOut, which pays the recipient the precompile'spayoutOfrecord names the shares'previewRedeemvalue in the base asset, once per share, and redeems them assettledoes. This lets an unclaimed-property authority receive a dormant account's savings as cash.ICardsinterface (payoutOf) and aMockCardstest harness, likeMockReservations.Checks:
forge fmt --check,forge build,forge lint --deny warnings src/core,forge build --sizes src,FOUNDRY_PROFILE=ci forge test(669 passed). Used by the tempoxyz/cardsdormant accountscenario on localnet.Pyramid thread: https://pyramid.tehq.net/threads/3700e62c-ee77-49a8-9e5f-4692bb1682b3