-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86a87f6
commit 49989a1
Showing
7 changed files
with
252 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package metadata | ||
|
||
import ( | ||
"github.com/rss3-network/protocol-go/schema" | ||
"github.com/rss3-network/protocol-go/schema/typex" | ||
) | ||
|
||
var _ Metadata = (*GovernanceProposal)(nil) | ||
|
||
func (t GovernanceProposal) Type() schema.Type { | ||
return typex.GovernanceProposal | ||
} | ||
|
||
type GovernanceProposal struct { | ||
ID string `json:"id"` | ||
Body string `json:"body"` | ||
StartBlock string `json:"start_block"` | ||
EndBlock string `json:"end_block"` | ||
Options []string `json:"options"` | ||
Link string `json:"link"` | ||
} | ||
|
||
var _ Metadata = (*GovernanceVote)(nil) | ||
|
||
func (t GovernanceVote) Type() schema.Type { | ||
return typex.GovernanceVote | ||
} | ||
|
||
//go:generate go run --mod=mod github.com/dmarkham/enumer --values --type=GovernanceVoteAction --transform=snake --trimprefix=ActionGovernanceVote --output governance_vote.go --json --sql | ||
type GovernanceVoteAction uint64 | ||
|
||
var _ Metadata = (*GovernanceVoteAction)(nil) | ||
|
||
type GovernanceVote struct { | ||
Action GovernanceVoteAction `json:"action"` | ||
Count uint64 `json:"count"` | ||
Reason string `json:"reason"` | ||
Proposal GovernanceProposal `json:"token"` | ||
} | ||
|
||
func (r GovernanceVoteAction) Type() schema.Type { | ||
return typex.GovernanceVote | ||
} | ||
|
||
const ( | ||
ActionGovernanceFor GovernanceVoteAction = iota + 1 | ||
ActionGovernanceAgainst | ||
ActionGovernanceAbstain | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,6 +13,7 @@ const ( | |
Unknown Tag = iota | ||
Collectible | ||
Exchange | ||
Governance | ||
Metaverse | ||
RSS | ||
Social | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package typex | ||
|
||
import "github.com/rss3-network/protocol-go/schema/tag" | ||
|
||
//go:generate go run --mod=mod github.com/dmarkham/enumer --values --type=GovernanceType --transform=snake --trimprefix=Governance --output governance_string.go --json --sql | ||
type GovernanceType uint64 | ||
|
||
//goland:noinspection GoMixedReceiverTypes | ||
func (i GovernanceType) Name() string { | ||
return i.String() | ||
} | ||
|
||
//goland:noinspection GoMixedReceiverTypes | ||
func (i GovernanceType) Tag() tag.Tag { | ||
return tag.Governance | ||
} | ||
|
||
const ( | ||
GovernanceProposal GovernanceType = iota + 1 | ||
GovernanceVote | ||
) |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.