(define-map leaderboard principal {wins: uint, losses: uint, total-wagered: uint, total-won: uint})
(define-read-only (get-stats (user principal)) (map-get? leaderboard user))
(define-public (record-win (user principal) (amount uint))
(match (map-get? leaderboard user)
s (begin (map-set leaderboard user (merge s {wins: (+ (get wins s) u1), total-won: (+ (get total-won s) amount)})) (ok true))
(begin (map-set leaderboard user {wins: u1, losses: u0, total-wagered: u0, total-won: amount}) (ok true))))