Documentation
¶
Index ¶
- Constants
- Variables
- func CalculateExchangeRate(mintAccount *common.Account, nativeAmount float64, quarks uint64) float64
- func CalculateUsdMarketValue(ctx context.Context, data ocp_data.Provider, mint *common.Account, ...) (float64, float64, error)
- func GetLatestExchangeRateTime() time.Time
- func GetLaunchpadCurrencyCirculatingSupply(ctx context.Context, data ocp_data.Provider, mint *common.Account) (uint64, time.Time, error)
- func ValidateClientExchangeData(proto *transactionpb.VerifiedExchangeData) (bool, string)
- func ValidateLegacyClientExchangeData(ctx context.Context, log *zap.Logger, data ocp_data.Provider, ...) (bool, string, error)
- func ValidateVerifiedExchangeRate(proto *currencypb.VerifiedCoreMintFiatExchangeRate) (bool, string)
- func ValidateVerifiedReserveState(proto *currencypb.VerifiedLaunchpadCurrencyReserveState) (bool, string)
- type SendLimit
Constants ¶
const (
MaxDailyUsdLimit = 1_000.00
)
Variables ¶
var (
SendLimits = map[currency_lib.Code]SendLimit{}/* 163 elements not displayed */
)
todo: Better way of managing all of this
Functions ¶
func CalculateExchangeRate ¶ added in v0.22.0
func CalculateExchangeRate(mintAccount *common.Account, nativeAmount float64, quarks uint64) float64
CalculateExchangeRate calculates the exchange rate for a crypto value exchange.
func CalculateUsdMarketValue ¶
func CalculateUsdMarketValue(ctx context.Context, data ocp_data.Provider, mint *common.Account, quarks uint64, at time.Time) (float64, float64, error)
CalculateUsdMarketValue calculates the current USD market value of a crypto amount in quarks.
func GetLatestExchangeRateTime ¶
GetLatestExchangeRateTime gets the latest time for fetching an exchange rate. By synchronizing on a time, we can eliminate the amount of perceived volatility over short time spans.
func GetLaunchpadCurrencyCirculatingSupply ¶ added in v0.21.0
func GetLaunchpadCurrencyCirculatingSupply(ctx context.Context, data ocp_data.Provider, mint *common.Account) (uint64, time.Time, error)
GetLaunchpadCurrencyCirculatingSupply gets the current circulating supply in quarks for a launchpad currency directly from the blockchain
func ValidateClientExchangeData ¶
func ValidateClientExchangeData(proto *transactionpb.VerifiedExchangeData) (bool, string)
ValidateClientExchangeData validates client-provided exchange data with provable exchange rates and reserve states that were provided by server.
func ValidateLegacyClientExchangeData ¶ added in v0.22.0
func ValidateLegacyClientExchangeData(ctx context.Context, log *zap.Logger, data ocp_data.Provider, proto *transactionpb.ExchangeData) (bool, string, error)
ValidateLegacyClientExchangeData validates legacy proto exchange data provided by a client
func ValidateVerifiedExchangeRate ¶ added in v0.22.0
func ValidateVerifiedExchangeRate(proto *currencypb.VerifiedCoreMintFiatExchangeRate) (bool, string)
ValidateVerifiedExchangeRate validates a server-signed exchange rate provided by a client. It verifies that the signature is valid and that the timestamp is not too far in the past.
func ValidateVerifiedReserveState ¶ added in v0.22.0
func ValidateVerifiedReserveState(proto *currencypb.VerifiedLaunchpadCurrencyReserveState) (bool, string)
ValidateVerifiedReserveState validates a server-signed reserve state provided by a client. It verifies that the signature is valid and that the timestamp is not too far in the past.