-
Notifications
You must be signed in to change notification settings - Fork 12
/
auxiliary_request.go
42 lines (34 loc) · 1.1 KB
/
auxiliary_request.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright [2021] - [2022], AssetMantle Pte. Ltd. and the code contributors
// SPDX-License-Identifier: Apache-2.0
package bond
import (
"github.com/AssetMantle/schema/go/ids"
"github.com/asaskevich/govalidator"
sdkTypes "github.com/cosmos/cosmos-sdk/types"
"github.com/AssetMantle/modules/helpers"
)
type auxiliaryRequest struct {
classificationID ids.ClassificationID
accAddress sdkTypes.AccAddress
bondAmount sdkTypes.Int
}
var _ helpers.AuxiliaryRequest = (*auxiliaryRequest)(nil)
func (auxiliaryRequest auxiliaryRequest) Validate() error {
_, err := govalidator.ValidateStruct(auxiliaryRequest)
return err
}
func auxiliaryRequestFromInterface(request helpers.AuxiliaryRequest) auxiliaryRequest {
switch value := request.(type) {
case auxiliaryRequest:
return value
default:
return auxiliaryRequest{}
}
}
func NewAuxiliaryRequest(classificationID ids.ClassificationID, fromAddress sdkTypes.AccAddress, bondAmount sdkTypes.Int) helpers.AuxiliaryRequest {
return auxiliaryRequest{
classificationID: classificationID,
accAddress: fromAddress,
bondAmount: bondAmount,
}
}