44 "errors"
55 "fmt"
66
7- "github.com/2025-2A-T20-G91-INTERNO/src/rollup/pkg/types"
7+ . "github.com/2025-2A-T20-G91-INTERNO/src/rollup/pkg/types"
88 "github.com/holiman/uint256"
99)
1010
@@ -28,11 +28,11 @@ type Issuance struct {
2828 Title string `json:"title,omitempty" gorm:"not null"`
2929 Description string `json:"description,omitempty" gorm:"not null"`
3030 Promotion string `json:"promotion,omitempty" gorm:"not null"`
31- Token types. Address `json:"token,omitempty" gorm:"types:text;not null"`
32- CreatorAddress types. Address `json:"creator_address,omitempty" gorm:"types:text;not null"`
33- CollateralAddress types. Address `json:"collateral_address,omitempty" gorm:"types:text;not null"`
31+ Token Address `json:"token,omitempty" gorm:"types:text;not null"`
32+ CreatorAddress Address `json:"creator_address,omitempty" gorm:"types:text;not null"`
33+ CollateralAddress Address `json:"collateral_address,omitempty" gorm:"types:text;not null"`
3434 CollateralAmount * uint256.Int `json:"collateral_amount,omitempty" gorm:"types:text;not null"`
35- BadgeAddress types. Address `json:"badge_address,omitempty" gorm:"types:text;not null"`
35+ BadgeAddress Address `json:"badge_address,omitempty" gorm:"types:text;not null"`
3636 DebtIssued * uint256.Int `json:"debt_issued,omitempty" gorm:"types:text;not null"`
3737 MaxInterestRate * uint256.Int `json:"max_interest_rate,omitempty" gorm:"types:text;not null"`
3838 TotalObligation * uint256.Int `json:"total_obligation,omitempty" gorm:"types:text;not null;default:0"`
@@ -45,7 +45,7 @@ type Issuance struct {
4545 UpdatedAt int64 `json:"updated_at,omitempty" gorm:"default:0"`
4646}
4747
48- func NewIssuance (title string , description string , promotion string , token types. Address , creatorAddress types. Address , collateralAddress types. Address , collateralAmount * uint256.Int , badgeAddress types. Address , debtIssued * uint256.Int , maxInterestRate * uint256.Int , closesAt int64 , maturityAt int64 , createdAt int64 ) (* Issuance , error ) {
48+ func NewIssuance (title string , description string , promotion string , token Address , creatorAddress Address , collateralAddress Address , collateralAmount * uint256.Int , badgeAddress Address , debtIssued * uint256.Int , maxInterestRate * uint256.Int , closesAt int64 , maturityAt int64 , createdAt int64 ) (* Issuance , error ) {
4949 issuance := & Issuance {
5050 Title : title ,
5151 Description : description ,
@@ -79,19 +79,19 @@ func (a *Issuance) validate() error {
7979 if a .Promotion == "" {
8080 return fmt .Errorf ("%w: promotion cannot be empty" , ErrInvalidIssuance )
8181 }
82- if a .Token == (types. Address {}) {
82+ if a .Token == (Address {}) {
8383 return fmt .Errorf ("%w: invalid token address" , ErrInvalidIssuance )
8484 }
85- if a .CreatorAddress == (types. Address {}) {
85+ if a .CreatorAddress == (Address {}) {
8686 return fmt .Errorf ("%w: invalid creator address" , ErrInvalidIssuance )
8787 }
88- if a .CollateralAddress == (types. Address {}) {
88+ if a .CollateralAddress == (Address {}) {
8989 return fmt .Errorf ("%w: invalid collateral address" , ErrInvalidIssuance )
9090 }
9191 if a .CollateralAmount .Sign () == 0 {
9292 return fmt .Errorf ("%w: collateral amount cannot be zero" , ErrInvalidIssuance )
9393 }
94- if a .BadgeAddress == (types. Address {}) {
94+ if a .BadgeAddress == (Address {}) {
9595 return fmt .Errorf ("%w: invalid badge address" , ErrInvalidIssuance )
9696 }
9797 if a .DebtIssued .Sign () == 0 {
0 commit comments