Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Layer.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
module Cardano.Wallet.DB.Store.Delegations.Layer | ||
( isStakeKeyRegistered | ||
, putDelegationCertificate | ||
, readDelegation | ||
) | ||
where | ||
|
||
import Prelude | ||
|
||
import Cardano.Wallet.DB.Store.Delegations.Model | ||
( Delegations, DeltaDelegations ) | ||
import Cardano.Wallet.Primitive.Types | ||
( DelegationCertificate, SlotNo, WalletDelegation ) | ||
|
||
|
||
isStakeKeyRegistered :: Delegations -> Bool | ||
isStakeKeyRegistered = error "TODO: isStakeKeyRegistered" | ||
|
||
-- ^ Binds a stake pool id to a wallet. This will have an influence on | ||
-- the wallet metadata: the last known certificate will indicate to | ||
-- which pool a wallet is currently delegating. | ||
-- | ||
-- This is done separately from 'putWalletMeta' because certificate | ||
-- declarations are: | ||
-- | ||
-- 1. Stored on-chain. | ||
-- 2. Affected by rollbacks (or said differently, tied to a 'SlotNo'). | ||
putDelegationCertificate | ||
:: DelegationCertificate | ||
-> SlotNo | ||
-> DeltaDelegations | ||
putDelegationCertificate = error "TODO: putDelegationCertificate" | ||
|
||
|
||
readDelegation :: SlotNo -> Delegations -> WalletDelegation | ||
readDelegation = error "TODO: readDelegation" |
18 changes: 18 additions & 0 deletions
18
lib/wallet/src/Cardano/Wallet/DB/Store/Delegations/Model.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module Cardano.Wallet.DB.Store.Delegations.Model | ||
( Delegations | ||
, DeltaDelegations | ||
) where | ||
|
||
|
||
import Cardano.Pool.Types | ||
( PoolId ) | ||
import Cardano.Wallet.Delegation.Model | ||
( History, Operation ) | ||
import Cardano.Wallet.Primitive.Types | ||
( SlotNo ) | ||
|
||
-- | Wallet delegation history | ||
type Delegations = History SlotNo PoolId | ||
|
||
-- | Delta of wallet delegation history | ||
type DeltaDelegations = Operation SlotNo PoolId |