currency

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2026 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxDailyUsdLimit = 1_000.00
)

Variables

View Source
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

func GetLatestExchangeRateTime() time.Time

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.

Types

type SendLimit

type SendLimit struct {
	PerTransaction float64
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL