xyz.stratalab.sdk.models.box.ValueValidator.scala Maven / Gradle / Ivy
The newest version!
package xyz.stratalab.sdk.models.box
object ValueValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Value] {
def validate(input: xyz.stratalab.sdk.models.box.Value): scalapb.validate.Result =
scalapb.validate.Result.optional(input.value.lvl) { _value =>
xyz.stratalab.sdk.models.box.ValueValidator.LVLValidator.validate(_value)
} &&
scalapb.validate.Result.optional(input.value.topl) { _value =>
xyz.stratalab.sdk.models.box.ValueValidator.TOPLValidator.validate(_value)
} &&
scalapb.validate.Result.optional(input.value.asset) { _value =>
xyz.stratalab.sdk.models.box.ValueValidator.AssetValidator.validate(_value)
} &&
scalapb.validate.Result.optional(input.value.group) { _value =>
xyz.stratalab.sdk.models.box.ValueValidator.GroupValidator.validate(_value)
} &&
scalapb.validate.Result.optional(input.value.series) { _value =>
xyz.stratalab.sdk.models.box.ValueValidator.SeriesValidator.validate(_value)
} &&
scalapb.validate.Result.optional(input.value.updateProposal) { _value =>
xyz.stratalab.sdk.models.box.ValueValidator.UpdateProposalValidator.validate(_value)
}
object LVLValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Value.LVL] {
def validate(input: xyz.stratalab.sdk.models.box.Value.LVL): scalapb.validate.Result =
quivr.models.Int128Validator.validate(input.quantity)
}
object TOPLValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Value.TOPL] {
def validate(input: xyz.stratalab.sdk.models.box.Value.TOPL): scalapb.validate.Result =
quivr.models.Int128Validator.validate(input.quantity) &&
scalapb.validate.Result.optional(input.registration) { _value =>
xyz.stratalab.consensus.models.StakingRegistrationValidator.validate(_value)
}
}
object AssetValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Value.Asset] {
def validate(input: xyz.stratalab.sdk.models.box.Value.Asset): scalapb.validate.Result =
scalapb.validate.Result.optional(input.groupId) { _value =>
xyz.stratalab.sdk.models.GroupIdValidator.validate(_value)
} &&
scalapb.validate.Result.optional(input.seriesId) { _value =>
xyz.stratalab.sdk.models.SeriesIdValidator.validate(_value)
} &&
quivr.models.Int128Validator.validate(input.quantity) &&
scalapb.validate.Result.optional(input.groupAlloy) { _value =>
scalapb.validate.Result.run(io.envoyproxy.pgv.BytesValidation.length("Value.Asset.groupAlloy", _value, 32))
} &&
scalapb.validate.Result.optional(input.seriesAlloy) { _value =>
scalapb.validate.Result.run(io.envoyproxy.pgv.BytesValidation.length("Value.Asset.seriesAlloy", _value, 32))
} &&
scalapb.validate.Result.optional(input.commitment) { _value =>
scalapb.validate.Result.run(io.envoyproxy.pgv.BytesValidation.length("Value.Asset.commitment", _value, 32))
}
}
object GroupValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Value.Group] {
def validate(input: xyz.stratalab.sdk.models.box.Value.Group): scalapb.validate.Result =
xyz.stratalab.sdk.models.GroupIdValidator.validate(input.groupId) &&
quivr.models.Int128Validator.validate(input.quantity) &&
scalapb.validate.Result.optional(input.fixedSeries) { _value =>
xyz.stratalab.sdk.models.SeriesIdValidator.validate(_value)
}
}
object SeriesValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Value.Series] {
def validate(input: xyz.stratalab.sdk.models.box.Value.Series): scalapb.validate.Result =
xyz.stratalab.sdk.models.SeriesIdValidator.validate(input.seriesId) &&
quivr.models.Int128Validator.validate(input.quantity)
}
object UpdateProposalValidator extends scalapb.validate.Validator[xyz.stratalab.sdk.models.box.Value.UpdateProposal] {
def validate(input: xyz.stratalab.sdk.models.box.Value.UpdateProposal): scalapb.validate.Result =
scalapb.validate.Result.optional(input.fEffective) { _value =>
quivr.models.RatioValidator.validate(_value)
} &&
scalapb.validate.Result.optional(input.vrfBaselineDifficulty) { _value =>
quivr.models.RatioValidator.validate(_value)
} &&
scalapb.validate.Result.optional(input.vrfAmplitude) { _value =>
quivr.models.RatioValidator.validate(_value)
}
}
}