|
|
@@ -2,6 +2,7 @@ package utils |
|
|
|
|
|
|
|
import ( |
|
|
|
"fmt" |
|
|
|
"math" |
|
|
|
|
|
|
|
"github.com/imosed/signet/client" |
|
|
|
. "github.com/imosed/signet/data" |
|
|
@@ -14,6 +15,11 @@ import ( |
|
|
|
"gorm.io/gorm/clause" |
|
|
|
) |
|
|
|
|
|
|
|
func getFraction(price float64) xdr.Price { |
|
|
|
factor := math.Pow(10, 8) |
|
|
|
return xdr.Price{N: xdr.Int32(price * factor), D: xdr.Int32(factor)} |
|
|
|
} |
|
|
|
|
|
|
|
func SubmitGroupFund(fundID uint) (bool, error) { |
|
|
|
var fund RewardFund |
|
|
|
Db.Preload(clause.Associations).Find(&fund, fundID) |
|
|
@@ -63,7 +69,7 @@ func SubmitGroupFund(fundID uint) (bool, error) { |
|
|
|
Issuer: fund.IssuerWallet, |
|
|
|
}, |
|
|
|
Amount: fmt.Sprintf("%f", submissionAmount), |
|
|
|
Price: xdr.Price{N: 1, D: xdr.Int32(fund.Price)}, |
|
|
|
Price: getFraction(fund.Price), |
|
|
|
OfferID: 0, |
|
|
|
SourceAccount: fund.FundWallet, |
|
|
|
}, |
|
|
|