1// SPDX-License-Identifier: ISC
2// Copyright (c) 2014-2020 Bitmark Inc.
3// Use of this source code is governed by an ISC
4// license that can be found in the LICENSE file.
5
6package ownership
7
8import (
9	"github.com/bitmark-inc/bitmarkd/account"
10	"github.com/bitmark-inc/bitmarkd/storage"
11)
12
13// Ownership - interface for ownership
14type Ownership interface {
15	ListBitmarksFor(*account.Account, uint64, int) ([]Record, error)
16}
17
18type ownership struct {
19	PoolOwnerList storage.Handle
20	PoolOwnerData storage.Handle
21}
22
23func (o ownership) ListBitmarksFor(owner *account.Account, start uint64, count int) ([]Record, error) {
24	return listBitmarksFor(owner, start, count)
25}
26
27var data ownership
28
29// Initialise - initialise ownership
30func Initialise(ownerList, ownerData storage.Handle) {
31	data = ownership{
32		PoolOwnerList: ownerList,
33		PoolOwnerData: ownerData,
34	}
35}
36
37// Get - return Record interface
38func Get() Ownership {
39	return &data
40}
41