contract

package
v0.3.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 26, 2024 License: Apache-2.0 Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotDeployed = errors.New("not deployed")
View Source
var ErrProviderNotFound = errors.New("provider not found")
View Source
var V1Code, _ = cell.FromBOC(_V1CodeHex)

Functions

func PrepareV1DeployData

func PrepareV1DeployData(torrentHash, merkleHash []byte, dataSize uint64, pieceSize uint32, ownerAddr *address.Address, providers []ProviderV1) (contractAddr *address.Address, stateInit *tlb.StateInit, body *cell.Cell, err error)

func PrepareWithdrawalRequest

func PrepareWithdrawalRequest(torrentHash, merkleHash []byte, dataSize uint64, pieceSize uint32, ownerAddr *address.Address) (contractAddr *address.Address, body *cell.Cell, err error)

Types

type ProviderDataV1

type ProviderDataV1 struct {
	Key         []byte
	LastProofAt time.Time
	ByteToProof uint64
	MaxSpan     uint32
	RatePerMB   tlb.Coins
	Nonce       uint64
}

func GetProviderDataV1

func GetProviderDataV1(ctx context.Context, api ton.APIClientWrapped, master *ton.BlockIDExt, contractAddr *address.Address, key []byte) (*ProviderDataV1, tlb.Coins, error)

func GetProvidersV1

func GetProvidersV1(ctx context.Context, api ton.APIClientWrapped, master *ton.BlockIDExt, contractAddr *address.Address) ([]ProviderDataV1, tlb.Coins, error)

type ProviderV1

type ProviderV1 struct {
	Address       *address.Address
	MaxSpan       uint32
	PricePerMBDay tlb.Coins
}

type StorageDataV1

type StorageDataV1 struct {
	TorrentHash []byte
	Size        uint64
	ChunkSize   uint64
	OwnerAddr   *address.Address
	MerkleHash  []byte
}

func GetStorageInfoV1

func GetStorageInfoV1(ctx context.Context, api ton.APIClientWrapped, master *ton.BlockIDExt, contractAddr *address.Address) (*StorageDataV1, error)

type StorageV1

type StorageV1 struct {
	TorrentHash     []byte           `tlb:"bits 256"`
	ActiveProviders *cell.Dictionary `tlb:"dict 256"`
	OwnerAddr       *address.Address `tlb:"addr"`
	DataSize        uint64           `tlb:"## 64"`
	PieceSize       uint32           `tlb:"## 32"`
	MerkleHash      []byte           `tlb:"bits 256"`
	KeyLen          uint8            `tlb:"## 8"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL