delegate

package
v0.0.0-...-2597ab7 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package delegate provides bindings for the delegate.cash contracts.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Address

func Address() common.Address

Address returns the multi-chain vanity address used by all delegation registries.

Types

type Delegation

type Delegation struct {
	Vault    common.Address
	Delegate common.Address
	Contract eth.NullableAddress
	TokenID  eth.NullableUint256
}

A Delegation is a generalised structure capturing all delegation types. When converted to a Delegation, all type-specific delegations include at least the Vault and Delegate fields. A contract delegation also includes the Contract field, and a token delegation also includes the TokenID on top of this.

func AppendDelegations

func AppendDelegations[T DelegationBuilder](ctx context.Context, curr []*Delegation, fetch func(*bind.CallOpts, common.Address) ([]T, error), vault common.Address) ([]*Delegation, error)

AppendDelegations calls fetch(…, vault), converts all results to *Delegation, and appends them to curr, returning the extended slice. The original slice is unchanged.

The fetch argument is compatible with the following IDelegationRegistry methods without the need to specify T:

GetAppendableDelegatesForAll()
GetContractLevelDelegations()
GetTokenLevelDelegations()

type DelegationBuilder

type DelegationBuilder interface {
	Delegation(vault common.Address) *Delegation
}

A DelegationBuilder can build a Delegation for a given vault address. It is typically a converter from another type.

Directories

Path Synopsis
Package delegateimpl is a test-only package exposing code to deploy a delegate.cash DelegationRegistry.
Package delegateimpl is a test-only package exposing code to deploy a delegate.cash DelegationRegistry.

Jump to

Keyboard shortcuts

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