Skip to content

Commit

Permalink
chore: use int32 for redemption type
Browse files Browse the repository at this point in the history
  • Loading branch information
ze97286 committed Nov 4, 2024
1 parent 6ecaab2 commit d2f03e5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
14 changes: 14 additions & 0 deletions core/integration/steps/table_wrapper.go
Original file line number Diff line number Diff line change
Expand Up @@ -897,3 +897,17 @@ func stringToU64(s string) uint64 {
i, _ := strconv.ParseUint(s, 10, 64)
return i
}

func (r RowWrapper) MustI32(name string) int32 {
value, err := I32(r.mustColumn(name))
panicW(name, err)
return value
}

func I32(rawValue string) (int32, error) {
parsed, err := strconv.ParseInt(rawValue, 10, 32)
if err != nil {
return 0, err
}
return int32(parsed), nil
}
6 changes: 3 additions & 3 deletions core/integration/steps/vault_actions.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,22 +293,22 @@ func prepareVaultFromTable(row vaultRow) *types.Vault {

redemptionDates := []*types.RedemptionDate{}
redemptionDates = append(redemptionDates, &types.RedemptionDate{
RedemptionType: vega.RedemptionType(row.row.MustI64("redemption date1 type")),
RedemptionType: vega.RedemptionType(row.row.MustI32("redemption date1 type")),
RedemptionDate: time.Unix(row.row.MustI64("redemption date1 date"), 0),
MaxFraction: row.row.MustDecimal("redemption date1 max fraction"),
})

if row.row.HasColumn("redemption date2 type") {
redemptionDates = append(redemptionDates, &types.RedemptionDate{
RedemptionType: vega.RedemptionType(row.row.MustI64("redemption date2 type")),
RedemptionType: vega.RedemptionType(row.row.MustI32("redemption date2 type")),
RedemptionDate: time.Unix(row.row.MustI64("redemption date2 date"), 0),
MaxFraction: row.row.MustDecimal("redemption date2 max fraction"),
})
}

if row.row.HasColumn("redemption date3 type") {
redemptionDates = append(redemptionDates, &types.RedemptionDate{
RedemptionType: vega.RedemptionType(row.row.MustI64("redemption date3 type")),
RedemptionType: vega.RedemptionType(row.row.MustI32("redemption date3 type")),
RedemptionDate: time.Unix(row.row.MustI64("redemption date3 date"), 0),
MaxFraction: row.row.MustDecimal("redemption date3 max fraction"),
})
Expand Down

0 comments on commit d2f03e5

Please sign in to comment.