intrepidshape/elm-web3-ui/4.0.0

Web3.Ui.StakeCard

Generic stake-position card: amount staked, lock-days remaining, accrued yield, eligibility badge (e.g., floor-protection eligibility), plus claim and unstake action buttons. Intended for any lock-and-yield staking contract.

The reward is frequently a different token from the stake, so it carries its own yieldDecimals: formatting a 6-decimal reward with an 18-decimal stake token's scale understates it by a factor of 1e12.

Web3.Ui.StakeCard.view []
    { amount = position.amount
    , symbol = "TKN"
    , decimals = 18
    , startTimeSec = position.startTime
    , lockDays = position.lockDays
    , nowSec = nowSec
    , yieldAccrued = position.yieldAccrued
    , yieldSymbol = "PLS"
    , yieldDecimals = 18
    , badges = [ { active = position.floorEligible, label = "floor protected" } ]
    , onClaimYield = Just (ClaimYield idx)
    , onUnstake = Just (Unstake idx)
    , unstakeLabel = "Unstake"
    }

Style: web3-stakecard, web3-stakecard__amount, web3-stakecard__lock, web3-stakecard__yield, web3-stakecard__badge, web3-stakecard__actions, web3-stakecard__action.

view : List (Attribute msg) -> Config msg -> Html msg

Render a stake-position card.

type alias Config msg =
{ amount : BigInt
, symbol : String
, decimals : Int
, startTimeSec : Int
, lockDays : Int
, nowSec : Int
, yieldAccrued : BigInt
, yieldSymbol : String
, yieldDecimals : Int
, badges :
List
{ active : Bool
, label : String
}
, onClaimYield : Maybe msg
, onUnstake : Maybe msg
, unstakeLabel : String
}