Skip to content

Commit

Permalink
manifest: add Required field to Standard
Browse files Browse the repository at this point in the history
`Required` contains standards that are required for this standard.

Signed-off-by: Ekaterina Pavlova <[email protected]>
  • Loading branch information
AliceInHunterland committed Nov 5, 2024
1 parent b8a65d3 commit 3a55edf
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pkg/smartcontract/manifest/standard/check.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ type Standard struct {
// If contract contains method with the same name and parameter count,
// it must have signature declared by this contract.
Optional []manifest.Method
// Required contains standards that are required for this standard.
Required []string
}
5 changes: 5 additions & 0 deletions pkg/smartcontract/manifest/standard/comply.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,11 @@ func ComplyABI(m *manifest.Manifest, st *Standard) error {
}

func comply(m *manifest.Manifest, checkNames bool, st *Standard) error {
if len(st.Required) > 0 {
if err := check(m, checkNames, st.Required...); err != nil {
return fmt.Errorf("required standard '%s' is not supported: %w", st.Name, err)
}
}
if st.Base != nil {
if err := comply(m, checkNames, st.Base); err != nil {
return err
Expand Down

0 comments on commit 3a55edf

Please sign in to comment.