Skip to content

Commit

Permalink
Merge branch 'main' into dev/upgrade_structs
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored May 4, 2022
2 parents 6732ef8 + 18a3bb3 commit c8999af
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
12 changes: 8 additions & 4 deletions osmoutils/partialord/partialord_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@ import (
func TestAPI(t *testing.T) {
// begin block use case, we have a dozen modules, but only care about a couple orders.
// In practice this will be gotten from some API, e.g. app.AllModuleNames()
moduleNames := []string{"auth", "authz", "bank", "capabilities",
moduleNames := []string{
"auth", "authz", "bank", "capabilities",
"staking", "distribution", "epochs", "mint", "upgrades", "wasm", "ibc",
"ibctransfers", "bech32ibc"}
"ibctransfers", "bech32ibc",
}
beginBlockOrd := partialord.NewPartialOrdering(moduleNames)
beginBlockOrd.FirstElements("upgrades", "epochs", "capabilities")
beginBlockOrd.After("ibctransfers", "ibc")
Expand All @@ -23,9 +25,11 @@ func TestAPI(t *testing.T) {
beginBlockOrd.LastElements("auth", "authz", "wasm")

totalOrd := beginBlockOrd.TotalOrdering()
expTotalOrd := []string{"upgrades", "epochs", "capabilities",
expTotalOrd := []string{
"upgrades", "epochs", "capabilities",
"bank", "staking", "mint", "ibc", "distribution", "ibctransfers", "bech32ibc",
"auth", "authz", "wasm"}
"auth", "authz", "wasm",
}
require.Equal(t, expTotalOrd, totalOrd)
}

Expand Down
2 changes: 1 addition & 1 deletion tests/e2e/chain_init/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func main() {

b, _ := json.Marshal(createdChain)
fileName := fmt.Sprintf("%v/%v-encode", dataDir, chainId)
if err = os.WriteFile(fileName, b, 0777); err != nil {
if err = os.WriteFile(fileName, b, 0o777); err != nil {
panic(err)
}
}
1 change: 0 additions & 1 deletion tests/e2e/e2e_setup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,6 @@ func (s *IntegrationTestSuite) configureChain(chainId string) {
}
}
s.chains = append(s.chains, &newChain)

}

func (s *IntegrationTestSuite) configureDockerResources(chainIDOne, chainIDTwo string) {
Expand Down
1 change: 0 additions & 1 deletion x/gamm/pool-models/balancer/amm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,6 @@ func TestCalcSingleAssetInAndOut_InverseRelationship(t *testing.T) {
for _, tc := range testcases {
for _, swapFee := range swapFeeCases {
t.Run(getTestCaseName(tc, swapFee), func(t *testing.T) {

swapFeeDec, err := sdk.NewDecFromStr(swapFee)
require.NoError(t, err)

Expand Down
12 changes: 12 additions & 0 deletions x/gamm/pool-models/stableswap/amm.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ func cfmmConstant(xReserve, yReserve sdk.Dec) sdk.Dec {
return xy.Mul(x2.Add(y2))
}

// multi-asset CFMM is xyu(x^2 + y^2 + v) = k,
// where u is the product of the reserves of assets
// outside of x and y (e.g. u = wz), and v is the sum
// of their squares (e.g. v = w^2 + z^2).
// When u = 1 and v = 0, this is equivalent to solidly's CFMM
func cfmmConstantMulti(xReserve, yReserve, uReserve, vSumSquares sdk.Dec) sdk.Dec {
xyu := xReserve.Mul(yReserve.Mul(uReserve))
x2 := xReserve.Mul(xReserve)
y2 := yReserve.Mul(yReserve)
return xyu.Mul(x2.Add(y2).Add(vSumSquares))
}

// solidly CFMM is xy(x^2 + y^2) = k
// So we want to solve for a given addition of `b` units of y into the pool,
// how many units `a` of x do we get out.
Expand Down

0 comments on commit c8999af

Please sign in to comment.