Skip to content

Commit

Permalink
introduce GetActionID
Browse files Browse the repository at this point in the history
  • Loading branch information
wlawt committed Apr 21, 2024
1 parent 579dad0 commit 32abc4b
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions chain/dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,10 @@ type Object interface {
type Action interface {
Object

// GetActionID returns the ActionID for an [Action] in a [Transaction]. There may be
// multiple [Action]s, so we pass its index in the [Action] array along with the txID.
GetActionID(idx uint8, txID ids.ID) codec.Address

// MaxComputeUnits is the maximum amount of compute a given [Action] could use. This is
// used to determine whether the [Action] can be included in a given block and to compute
// the required fee to execute.
Expand Down
4 changes: 4 additions & 0 deletions examples/morpheusvm/actions/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ func (*Transfer) GetTypeID() uint8 {
return mconsts.TransferID
}

func (*BurnAsset) GetActionID(idx uint8, txID ids.ID) codec.Address {
return codec.CreateAddress(idx, txID)
}

func (t *Transfer) StateKeys(actor codec.Address, _ ids.ID) state.Keys {
return state.Keys{
string(storage.BalanceKey(actor)): state.Read | state.Write,
Expand Down

0 comments on commit 32abc4b

Please sign in to comment.