Documentation
¶
Overview ¶
Package proposalutils is copied from https://github.com/smartcontractkit/chainlink/blob/c2074f6d70cdf9164f15f4be3f7de8a8427919af/deployment/common/proposalutils/analyze.go#L1-L1 This is a temporary location.
Index ¶
- Constants
- func ContextGet[T any](ctx *ArgumentContext, key string) (T, error)
- func DescribeProposal(proposal *mcmslib.Proposal, describedOperations []string) string
- func DescribeTimelockProposal(proposal *mcmslib.TimelockProposal, describedBatches [][]string) string
- func GetChainNameBySelector(selector uint64) (string, error)
- type AddressArgument
- type Analyzer
- type Argument
- type ArgumentContext
- type ArrayArgument
- type BytesArgument
- type ChainSelectorArgument
- type DecodedCall
- type NamedArgument
- type SimpleArgument
- type StructArgument
- type TxCallDecoder
Constants ¶
const ( Indent = " " DoubleIndent = Indent + Indent // Magic number constants MinStructFieldsForPrettyFormat = 2 MinDataLengthForMethodID = 4 DefaultAnalyzersCount = 2 )
Variables ¶
This section is empty.
Functions ¶
func ContextGet ¶
func ContextGet[T any](ctx *ArgumentContext, key string) (T, error)
func DescribeProposal ¶
func DescribeTimelockProposal ¶
func DescribeTimelockProposal(proposal *mcmslib.TimelockProposal, describedBatches [][]string) string
func GetChainNameBySelector ¶
Types ¶
type AddressArgument ¶
type AddressArgument struct {
Value string
}
func (AddressArgument) Annotation ¶
func (a AddressArgument) Annotation(ctx *ArgumentContext) string
Annotation returns only the annotation if known, otherwise "".
func (AddressArgument) Describe ¶
func (a AddressArgument) Describe(_ *ArgumentContext) string
type Analyzer ¶
Analyzer is an extension point of proposal decoding. You can implement your own Analyzer which returns your own Argument instance.
type Argument ¶
type Argument interface {
Describe(ctx *ArgumentContext) string
}
Argument is a unit of decoded proposal. Calling Describe on it returns human-readable representation of its content. Some implementations are recursive (arrays, structs) and require attention to formatting.
func BytesAndAddressAnalyzer ¶
type ArgumentContext ¶
ArgumentContext is a storage for context that may need to Argument during its description. Refer to BytesAndAddressAnalyzer and ChainSelectorAnalyzer for usage examples
func NewArgumentContext ¶
func NewArgumentContext(addresses deployment.AddressesByChain) *ArgumentContext
type ArrayArgument ¶
type ArrayArgument struct {
Elements []Argument
}
func (ArrayArgument) Describe ¶
func (a ArrayArgument) Describe(context *ArgumentContext) string
type BytesArgument ¶
type BytesArgument struct {
Value []byte
}
func (BytesArgument) Describe ¶
func (a BytesArgument) Describe(_ *ArgumentContext) string
type ChainSelectorArgument ¶
type ChainSelectorArgument struct {
Value uint64
}
func (ChainSelectorArgument) Describe ¶
func (c ChainSelectorArgument) Describe(_ *ArgumentContext) string
type DecodedCall ¶
type DecodedCall struct { Address string Method string Inputs []NamedArgument Outputs []NamedArgument }
func (*DecodedCall) Describe ¶
func (d *DecodedCall) Describe(context *ArgumentContext) string
type NamedArgument ¶
func (NamedArgument) Describe ¶
func (n NamedArgument) Describe(context *ArgumentContext) string
type SimpleArgument ¶
type SimpleArgument struct {
Value string
}
func (SimpleArgument) Describe ¶
func (s SimpleArgument) Describe(_ *ArgumentContext) string
type StructArgument ¶
type StructArgument struct {
Fields []NamedArgument
}
func (StructArgument) Describe ¶
func (s StructArgument) Describe(context *ArgumentContext) string
type TxCallDecoder ¶
type TxCallDecoder struct {
Analyzers []Analyzer
}
func NewTxCallDecoder ¶
func NewTxCallDecoder(extraAnalyzers []Analyzer) *TxCallDecoder
func (*TxCallDecoder) Analyze ¶
func (p *TxCallDecoder) Analyze(address string, contractABI *abi.ABI, data []byte) (*DecodedCall, error)