github.com/mavryk-network/mvgo@v1.19.9/rpc/delegation.go (about)

     1  // Copyright (c) 2020-2021 Blockwatch Data Inc.
     2  // Author: alex@blockwatch.cc
     3  
     4  package rpc
     5  
     6  import "github.com/mavryk-network/mvgo/mavryk"
     7  
     8  // Ensure Delegation implements the TypedOperation interface.
     9  var _ TypedOperation = (*Delegation)(nil)
    10  
    11  // Delegation represents a transaction operation
    12  type Delegation struct {
    13  	Manager
    14  	Delegate mavryk.Address `json:"delegate,omitempty"`
    15  }
    16  
    17  // Cost returns operation cost to implement TypedOperation interface.
    18  func (d Delegation) Costs() mavryk.Costs {
    19  	return mavryk.Costs{
    20  		Fee:     d.Manager.Fee,
    21  		GasUsed: d.Metadata.Result.ConsumedGas,
    22  	}
    23  }