Documentation ¶
Index ¶
- Variables
- type ActionService
- func (a *ActionService) GetVote(id string) (aggregator.VotePayload, error)
- func (a *ActionService) Prepare(prepareParams PrepareParams) (db.PreparedVote, error)
- func (a *ActionService) Validate(validateParams ValidateParams) (ValidateResult, error)
- func (a *ActionService) Vote(voteParams VoteParams) (SuccessVote, error)
- type Domain
- type GrpcServer
- func (g *GrpcServer) GetVote(ctx context.Context, req *votingpb.GetVoteRequest) (*votingpb.GetVoteResponse, error)
- func (g *GrpcServer) Prepare(_ context.Context, req *votingpb.PrepareRequest) (*votingpb.PrepareResponse, error)
- func (g *GrpcServer) Validate(_ context.Context, req *votingpb.ValidateRequest) (*votingpb.ValidateResponse, error)
- func (g *GrpcServer) Vote(_ context.Context, req *votingpb.VoteRequest) (*votingpb.VoteResponse, error)
- type PrepareParams
- type ProposalType
- type Relayer
- type SuccessVote
- type TypedData
- type TypedSignDataBuilder
- type TypesDescription
- type ValidateParams
- type ValidateResult
- type ValidationError
- type Vote
- type VoteParams
- type VoteTypes
Constants ¶
This section is empty.
Variables ¶
View Source
var BasicValidationErr = &ValidationError{
Message: "You do not meet the minimum balance requirement to vote on this proposal.",
Code: 1002,
}
View Source
var EIP712Domain = []TypesDescription{
{Name: "name", Type: "string"},
{Name: "version", Type: "string"},
}
View Source
var NoVotingPowerErr = &ValidationError{
Message: "Oops, it seems you don't have any voting power at block %s.",
Code: 1000,
}
View Source
var NotValidErr = &ValidationError{
Message: "Oops, you don't seem to be eligible to submit a proposal.",
Code: 1001,
}
View Source
var PassportGatedValidationErr = &ValidationError{
Message: "You need a Gitcoin Passport with score above %s and %s of the following stamps to vote on this proposal: %s.",
Code: 1003,
}
PassportGatedValidationErr scoreThreshold, operator, stamps params
View Source
var VoteNumberTypes = []TypesDescription{
{Name: "from", Type: "address"},
{Name: "space", Type: "string"},
{Name: "timestamp", Type: "uint64"},
{Name: "proposal", Type: "string"},
{Name: "choice", Type: "uint32"},
{Name: "reason", Type: "string"},
{Name: "app", Type: "string"},
{Name: "metadata", Type: "string"},
}
View Source
var VoteNumberTypes2 = []TypesDescription{
{Name: "from", Type: "address"},
{Name: "space", Type: "string"},
{Name: "timestamp", Type: "uint64"},
{Name: "proposal", Type: "bytes32"},
{Name: "choice", Type: "uint32"},
{Name: "reason", Type: "string"},
{Name: "app", Type: "string"},
{Name: "metadata", Type: "string"},
}
View Source
var VoteNumbersTypes = []TypesDescription{
{Name: "from", Type: "address"},
{Name: "space", Type: "string"},
{Name: "timestamp", Type: "uint64"},
{Name: "proposal", Type: "string"},
{Name: "choice", Type: "uint32[]"},
{Name: "reason", Type: "string"},
{Name: "app", Type: "string"},
{Name: "metadata", Type: "string"},
}
View Source
var VoteNumbersTypes2 = []TypesDescription{
{Name: "from", Type: "address"},
{Name: "space", Type: "string"},
{Name: "timestamp", Type: "uint64"},
{Name: "proposal", Type: "bytes32"},
{Name: "choice", Type: "uint32[]"},
{Name: "reason", Type: "string"},
{Name: "app", Type: "string"},
{Name: "metadata", Type: "string"},
}
View Source
var VoteStringTypes = []TypesDescription{
{Name: "from", Type: "address"},
{Name: "space", Type: "string"},
{Name: "timestamp", Type: "uint64"},
{Name: "proposal", Type: "string"},
{Name: "choice", Type: "string"},
{Name: "reason", Type: "string"},
{Name: "app", Type: "string"},
{Name: "metadata", Type: "string"},
}
View Source
var VoteStringTypes2 = []TypesDescription{
{Name: "from", Type: "address"},
{Name: "space", Type: "string"},
{Name: "timestamp", Type: "uint64"},
{Name: "proposal", Type: "bytes32"},
{Name: "choice", Type: "string"},
{Name: "reason", Type: "string"},
{Name: "app", Type: "string"},
{Name: "metadata", Type: "string"},
}
Functions ¶
This section is empty.
Types ¶
type ActionService ¶
type ActionService struct {
// contains filtered or unexported fields
}
func NewActionService ¶
func NewActionService(snapshotSDK snapshotSDK, proposalGetter proposalGetter, typedSignDataBuilder *TypedSignDataBuilder, preparedVoteStorage preparedVoteStorage) *ActionService
func (*ActionService) GetVote ¶ added in v0.4.4
func (a *ActionService) GetVote(id string) (aggregator.VotePayload, error)
GetVote TODO think about DTO
func (*ActionService) Prepare ¶
func (a *ActionService) Prepare(prepareParams PrepareParams) (db.PreparedVote, error)
func (*ActionService) Validate ¶
func (a *ActionService) Validate(validateParams ValidateParams) (ValidateResult, error)
func (*ActionService) Vote ¶
func (a *ActionService) Vote(voteParams VoteParams) (SuccessVote, error)
type GrpcServer ¶
type GrpcServer struct { votingpb.UnimplementedVotingServer // contains filtered or unexported fields }
func NewGrpcServer ¶
func NewGrpcServer(actionService *ActionService) *GrpcServer
func (*GrpcServer) GetVote ¶ added in v0.4.4
func (g *GrpcServer) GetVote(ctx context.Context, req *votingpb.GetVoteRequest) (*votingpb.GetVoteResponse, error)
func (*GrpcServer) Prepare ¶
func (g *GrpcServer) Prepare(_ context.Context, req *votingpb.PrepareRequest) (*votingpb.PrepareResponse, error)
func (*GrpcServer) Validate ¶
func (g *GrpcServer) Validate(_ context.Context, req *votingpb.ValidateRequest) (*votingpb.ValidateResponse, error)
func (*GrpcServer) Vote ¶
func (g *GrpcServer) Vote(_ context.Context, req *votingpb.VoteRequest) (*votingpb.VoteResponse, error)
type PrepareParams ¶
type PrepareParams struct { Voter string Proposal string Choice json.RawMessage Reason *string }
type ProposalType ¶
type ProposalType string
type SuccessVote ¶
type TypedData ¶
type TypedData struct { Domain Domain `json:"domain"` PrimaryType string `json:"primaryType,omitempty"` VoteTypes VoteTypes `json:"types"` Vote Vote `json:"message"` }
func (TypedData) ForSnapshot ¶
type TypedSignDataBuilder ¶
type TypedSignDataBuilder struct {
// contains filtered or unexported fields
}
func NewTypedSignDataBuilder ¶
func NewTypedSignDataBuilder(cfg config.Snapshot) *TypedSignDataBuilder
func (*TypedSignDataBuilder) Build ¶
func (t *TypedSignDataBuilder) Build(checksumVoter string, reason *string, choice json.RawMessage, pFragment *client.ProposalFragment) (TypedData, error)
type TypesDescription ¶
type ValidateParams ¶
type ValidateResult ¶
type ValidateResult struct { OK bool VotingPower float64 ValidationError *ValidationError }
type ValidationError ¶
func (ValidationError) WithVars ¶
func (v ValidationError) WithVars(vars ...any) *ValidationError
type VoteParams ¶
type VoteTypes ¶
type VoteTypes struct { EIP712Domain []TypesDescription `json:"EIP712Domain,omitempty"` Vote []TypesDescription `json:"Vote"` }
Click to show internal directories.
Click to hide internal directories.