add xmars token

add xmars/mars astroport lp
add xmarspermars and marsperxmars method to mars governance
This commit is contained in:
Laurent Le Houerou 2022-04-18 15:17:54 +04:00
parent 4aa9e12c92
commit 5224955822
3 changed files with 33 additions and 0 deletions

View File

@ -56,6 +56,10 @@ func NewRouter(querier *terra.Querier) (terra.Router, error) {
if err != nil {
return nil, errors.Wrap(err, "init LUNABLUNA pair")
}
MARSXMARS, err := NewStablePair(querier, "terra1dawj5mr2qt2nlurge30lfgjg6ly4ls99yeyd25", terra.MARS, terra.XMARS, terra.ASTRO_MARSXMARSLP)
if err != nil {
return nil, errors.Wrap(err, "init MARSXMARS pair")
}
r.SetPairs(
LUNAUST,
@ -68,6 +72,7 @@ func NewRouter(querier *terra.Querier) (terra.Router, error) {
ASTROUST,
ASTROLUNA,
LUNABLUNA,
MARSXMARS,
//{terra.VKR, terra.UST},
//{terra.APOLLO, terra.UST},
//{terra.ORION, terra.UST},

View File

@ -1,6 +1,8 @@
package mars
import (
"context"
"github.com/galacticship/terra"
"github.com/galacticship/terra/cosmos"
"github.com/pkg/errors"
@ -27,3 +29,27 @@ func (g *Governance) NewStakeMessage(sender cosmos.AccAddress, amount decimal.De
}
return terra.MARS.NewMsgSendExecute(sender, g.Contract, amount, q)
}
func (g *Governance) XMARSperMARS(ctx context.Context) (decimal.Decimal, error) {
var q struct {
XMarsPerMars struct{} `json:"x_mars_per_mars"`
}
var r decimal.Decimal
err := g.QueryStore(ctx, q, &r)
if err != nil {
return decimal.Zero, errors.Wrap(err, "querying contract store")
}
return r, nil
}
func (g *Governance) MARSperXMARS(ctx context.Context) (decimal.Decimal, error) {
var q struct {
MarsPerXMars struct{} `json:"mars_per_x_mars"`
}
var r decimal.Decimal
err := g.QueryStore(ctx, q, &r)
if err != nil {
return decimal.Zero, errors.Wrap(err, "querying contract store")
}
return r, nil
}

View File

@ -51,6 +51,7 @@ var (
XSD, _ = NewCw20Token("terra1ln2z938phz0nc2wepxpzfkwp6ezn9yrz9zv9ep", "XSD", 8)
WHSD, _ = NewCw20Token("terra1ustvnmngueq0p4jd7gfnutgvdc6ujpsjhsjd02", "WHSD", 8)
XASTRO, _ = NewCw20Token("terra14lpnyzc9z4g3ugr4lhm8s4nle0tq8vcltkhzh7", "xASTRO", 6)
XMARS, _ = NewCw20Token("terra1a04v570f9cxp49mk06vjsm8axsswndpwwt67k4", "xMARS", 6)
)
var (
@ -64,6 +65,7 @@ var (
ASTRO_ASTROUSTLP, _ = NewCw20Token("terra17n5sunn88hpy965mzvt3079fqx3rttnplg779g", "uLP", 6)
ASTRO_ASTROLUNALP, _ = NewCw20Token("terra1ryxkslm6p04q0nl046quwz8ctdd5llkjnaccpa", "uLP", 6)
ASTRO_LUNABLUNALP, _ = NewCw20Token("terra1htw7hm40ch0hacm8qpgd24sus4h0tq3hsseatl", "uLP", 6)
ASTRO_MARSXMARSLP, _ = NewCw20Token("terra1cxmdyn5srv8uwvhgz5ckqf28zf8c7uwyz08f2j", "uLP", 6)
TERRASWAP_LUNAUSTLP, _ = NewCw20Token("terra17dkr9rnmtmu7x4azrpupukvur2crnptyfvsrvr", "uLP", 6)
TERRASWAP_BLUNALUNALP, _ = NewCw20Token("terra1nuy34nwnsh53ygpc4xprlj263cztw7vc99leh2", "uLP", 6)