-
Notifications
You must be signed in to change notification settings - Fork 48
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
1 changed file
with
59 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,77 @@ | ||
package keeper | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
|
||
"github.com/sideprotocol/side/x/btclightclient/types" | ||
) | ||
|
||
type UTXOViewKeeper interface { | ||
HasUTXO(ctx sdk.Context, hash string, vout uint64) bool | ||
IsUTXOLocked(ctx sdk.Context, hash string, vout uint64) bool | ||
|
||
GetAllUTXOs(ctx sdk.Context) []*types.UTXO | ||
|
||
GetUTXOsByAddr(ctx sdk.Context, addr string) []*types.UTXO | ||
GetOrderedUTXOsByAddr(ctx sdk.Context, addr string) []*types.UTXO | ||
} | ||
|
||
type UTXOKeeper interface { | ||
UTXOViewKeeper | ||
|
||
LockUTXO(ctx sdk.Context, hash string, vout uint64) | ||
SpendUTXO(ctx sdk.Context, hash string, vout uint64) | ||
} | ||
|
||
var _ UTXOKeeper = (*BaseUTXOKeeper)(nil) | ||
|
||
type BaseUTXOViewKeeper struct { | ||
k Keeper | ||
} | ||
|
||
func NewBaseUTXOViewKeeper(k Keeper) *BaseUTXOViewKeeper { | ||
return &BaseUTXOViewKeeper{k} | ||
} | ||
|
||
func (bvk *BaseUTXOViewKeeper) HasUTXO(ctx sdk.Context, hash string, vout uint64) bool { | ||
// TODO | ||
return true | ||
} | ||
|
||
func (bvk *BaseUTXOViewKeeper) IsUTXOLocked(ctx sdk.Context, hash string, vout uint64) bool { | ||
// TODO | ||
return true | ||
} | ||
|
||
func NewBaseUTXOViewKeeper() *BaseUTXOViewKeeper { | ||
return &BaseUTXOViewKeeper{} | ||
func (bvk *BaseUTXOViewKeeper) GetAllUTXOs(ctx sdk.Context) []*types.UTXO { | ||
// TODO | ||
return nil | ||
} | ||
|
||
func (bvk *BaseUTXOViewKeeper) GetUTXOsByAddr(ctx sdk.Context, addr string) []*types.UTXO { | ||
// TODO | ||
return nil | ||
} | ||
|
||
func (bvk *BaseUTXOViewKeeper) GetOrderedUTXOsByAddr(ctx sdk.Context, addr string) []*types.UTXO { | ||
// TODO | ||
return nil | ||
} | ||
|
||
type BaseUTXOKeeper struct { | ||
BaseUTXOViewKeeper | ||
|
||
k Keeper | ||
} | ||
|
||
func NewBaseUTXOKeeper(k Keeper) *BaseUTXOKeeper { | ||
return &BaseUTXOKeeper{BaseUTXOViewKeeper: *NewBaseUTXOViewKeeper(k), k: k} | ||
} | ||
|
||
func (bk *BaseUTXOKeeper) LockUTXO(ctx sdk.Context, hash string, vout uint64) { | ||
// TODO | ||
} | ||
|
||
func (bk *BaseUTXOKeeper) SpendUTXO(ctx sdk.Context, hash string, vout uint64) { | ||
// TODO | ||
} |