Skip to content

Commit

Permalink
Merge branch 'main' into feat/upload-new-audio-icon-#1395
Browse files Browse the repository at this point in the history
  • Loading branch information
kjawadDeveloper2 committed Dec 21, 2022
2 parents fa3cbf8 + fb730ef commit 13962d1
Show file tree
Hide file tree
Showing 406 changed files with 778,661 additions and 2,099 deletions.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ genesis/gamma
genesis/pylonsd

artifacts
*.plc
*.plr

cmd/pylonsd/__debug_bin
proto/dart/*

Expand All @@ -35,3 +34,7 @@ debug
*.env
wallet/android/app/google-services.json
mytestnet/
recipetool/.flutter-plugins
recipetool/.flutter-plugins-dependencies
recipetool/.dart_tool/
recipetool/build/
1 change: 1 addition & 0 deletions BVS gentx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"BVS","identity":"2DBB6C30FD1D52C4","website":"","security_contact":"","details":""},"commission":{"rate":"0.070000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.050000000000000000"},"min_self_delegation":"1","delegator_address":"pylo10fp57zm469ljpzyzmkurr9439x37rfnffdjura","validator_address":"pylovaloper10fp57zm469ljpzyzmkurr9439x37rfnfv9ltc3","pubkey":{"@type":"/cosmos.crypto.ed25519.PubKey","key":"Awf0LrmZRvM7ShEsCovBhrkWB6xC69gCn6N4JJhvEFc="},"value":{"denom":"ubedrock","amount":"200000000"}}],"memo":"1233d3696f3fbfb44edfaf72640bb91d085f3dae@65.109.34.133:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"Ah/UChdmGTKEmmlWRT0lo3/UIvqB2knDVadZUO86B5Wu"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""},"tip":null},"signatures":["suWOiBAKJLJPpNq9/FYUnXVgh4npNRgKnIPremeVBS4ulBkNuj+XppSzKxSlB+noBLznb9S4zC2T0YhMLTuHbw=="]}
21 changes: 17 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@ import (
evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper"

"github.com/Pylons-tech/pylons/app/upgrades"
v3 "github.com/Pylons-tech/pylons/app/upgrades/v3"
v4 "github.com/Pylons-tech/pylons/app/upgrades/v4"
v5 "github.com/Pylons-tech/pylons/app/upgrades/v5"
v1 "github.com/Pylons-tech/pylons/app/upgrades/mainnet/v1"
v3 "github.com/Pylons-tech/pylons/app/upgrades/testnet/v3"
v4 "github.com/Pylons-tech/pylons/app/upgrades/testnet/v4"
v5 "github.com/Pylons-tech/pylons/app/upgrades/testnet/v5"
v6 "github.com/Pylons-tech/pylons/app/upgrades/testnet/v6"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
"github.com/cosmos/cosmos-sdk/version"
Expand Down Expand Up @@ -146,7 +148,7 @@ var (
// Bech32PrefixConsPub defines the Bech32 prefix of a consensus node public key.
Bech32PrefixConsPub = AccountAddressPrefix + sdk.PrefixValidator + sdk.PrefixConsensus + sdk.PrefixPublic
// List upgrades
Upgrades = []upgrades.Upgrade{v3.Upgrade, v4.Upgrade, v5.Upgrade}
Upgrades = []upgrades.Upgrade{v3.Upgrade, v4.Upgrade, v5.Upgrade, v6.Upgrade}
)

func init() {
Expand Down Expand Up @@ -827,6 +829,17 @@ func (app *PylonsApp) setupUpgradeHandlers() {
v5.UpgradeName,
v5.CreateUpgradeHandler(app.mm, app.configurator, app.BankKeeper, &app.AccountKeeper, &app.StakingKeeper),
)

// v1.1.1 mainnet upgrade handler
app.UpgradeKeeper.SetUpgradeHandler(
v6.UpgradeName,
v6.CreateUpgradeHandler(app.mm, app.configurator, app.BankKeeper, &app.AccountKeeper, &app.StakingKeeper),
)
// v1.1.2 mainnet upgrade handler
app.UpgradeKeeper.SetUpgradeHandler(
v1.UpgradeName,
v1.CreateUpgradeHandler(app.mm, app.configurator, app.BankKeeper, &app.AccountKeeper, &app.StakingKeeper),
)
}

func (app *PylonsApp) setupUpgradeStoreLoaders() {
Expand Down
22 changes: 22 additions & 0 deletions app/upgrades/mainnet/v1/constant.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v1

import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"

"github.com/Pylons-tech/pylons/app/upgrades"
)

const (
// UpgradeName is the shared upgrade plan name for mainnet and testnet
UpgradeName = "v1.1.2"
)

// TODO: Update StoreUpgrades

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
StoreUpgrades: storetypes.StoreUpgrades{
Added: []string{},
Deleted: []string{},
},
}
92 changes: 92 additions & 0 deletions app/upgrades/mainnet/v1/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package v1

import (
"cosmossdk.io/math"
"github.com/Pylons-tech/pylons/x/pylons/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

const (
// mainnet master wallet address
MasterWallet = "pylo1vnwhaymaazugzz9ln2sznddveyed6shz3x8xwl"
MaxSupply = 100_000_000_000_000
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
bankKeeper bankkeeper.Keeper,
accKeeper *authkeeper.AccountKeeper,
staking *stakingkeeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// logger := ctx.Logger()

bankBaseKeeper, _ := bankKeeper.(bankkeeper.BaseKeeper)
if types.IsMainnet(ctx.ChainID()) {
BurnToken(ctx, accKeeper, &bankBaseKeeper, staking)
}

vm, err := mm.RunMigrations(ctx, configurator, fromVM)
return vm, err
}
}

// Burn bedrock denom token
func BurnToken(ctx sdk.Context, accKeeper *authkeeper.AccountKeeper, bank *bankkeeper.BaseKeeper, staking *stakingkeeper.Keeper) {
// only burn bedrock token
denom := types.StakingCoinDenom
// Get all delegations
delegations := staking.GetAllDelegations(ctx)
// Get all account balances
accs := bank.GetAccountsBalances(ctx)
for _, acc := range accs {
found := false
balance := acc.Coins.AmountOf(denom)
// Check if denom token amount GT 0
if balance.GT(math.ZeroInt()) {
for _, delegator := range delegations {
// Check if account address is equal to delegator address, if equal do nothing
if acc.Address == delegator.DelegatorAddress || acc.Address == MasterWallet {
found = true
break
} else {
// If account address address is not equal to delegator address burn token
found = false
}
}
if !found {
amount := sdk.NewCoin(denom, balance)
BurnCoins(ctx, bank, acc.Address, amount)
}
}
}

supply := bank.GetSupply(ctx, denom)
maxSupply := math.NewInt(MaxSupply)
if supply.Amount.GT(maxSupply) {

extraSupply := supply.Amount.Sub(maxSupply)
extraCoins := sdk.NewCoin(denom, extraSupply)
BurnCoins(ctx, bank, MasterWallet, extraCoins)

}
}

func BurnCoins(ctx sdk.Context, bank *bankkeeper.BaseKeeper, acc string, amount sdk.Coin) {
// Send denom token to module
err := bank.SendCoinsFromAccountToModule(ctx, sdk.MustAccAddressFromBech32(acc), types.PaymentsProcessorName, sdk.NewCoins(amount))
if err != nil {
panic(err)
}
// Burn denom token in module
err = bank.BurnCoins(ctx, types.PaymentsProcessorName, sdk.NewCoins(amount))
if err != nil {
panic(err)
}
}
45 changes: 45 additions & 0 deletions app/upgrades/mainnet/v1/upgrage_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
package v1_test

import (
"testing"

"cosmossdk.io/math"
"github.com/Pylons-tech/pylons/app/apptesting"
v1 "github.com/Pylons-tech/pylons/app/upgrades/mainnet/v1"
sdk "github.com/cosmos/cosmos-sdk/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/stretchr/testify/suite"
)

var (
stakingCoinDenom string = "ubedrock"
defaultAcctFundsBedrockCoin sdk.Coins = sdk.NewCoins(
sdk.NewCoin(stakingCoinDenom, sdk.NewInt(10_000_000)),
)
)

type UpgradeTestSuite struct {
apptesting.KeeperTestHelper
}

func TestUpgradeTestSuite(t *testing.T) {
s := new(UpgradeTestSuite)
suite.Run(t, s)
}

func (suite *UpgradeTestSuite) TestBurnToken_Ubedrock() {
suite.Setup()
// Fund ubedrock to test account
for _, acc := range suite.TestAccs {
suite.FundAcc(acc, defaultAcctFundsBedrockCoin)
}
// Get ubedrock total supply
totalAmount := suite.App.BankKeeper.GetSupply(suite.Ctx, stakingCoinDenom)
suite.Require().Equal(totalAmount.Amount, math.NewInt(31_000_000))
// Burn ubedrock
bankBaseKeeper, _ := suite.App.BankKeeper.(bankkeeper.BaseKeeper)
v1.BurnToken(suite.Ctx, &suite.App.AccountKeeper, &bankBaseKeeper, &suite.App.StakingKeeper)
// Check ubedrock total supply (should equal 0)
totalAmount = suite.App.BankKeeper.GetSupply(suite.Ctx, stakingCoinDenom)
suite.Require().Equal(totalAmount.Amount, math.ZeroInt())
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"time"

"github.com/Pylons-tech/pylons/app"
v4 "github.com/Pylons-tech/pylons/app/upgrades/v4"
v4 "github.com/Pylons-tech/pylons/app/upgrades/testnet/v4"
sdk "github.com/cosmos/cosmos-sdk/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/stretchr/testify/require"
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"cosmossdk.io/math"
"github.com/Pylons-tech/pylons/app/apptesting"
v4 "github.com/Pylons-tech/pylons/app/upgrades/v4"
v4 "github.com/Pylons-tech/pylons/app/upgrades/testnet/v4"
"github.com/Pylons-tech/pylons/x/pylons/types"
sdk "github.com/cosmos/cosmos-sdk/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
Expand Down Expand Up @@ -133,7 +133,7 @@ func (suite *UpgradeTestSuite) TestCleanUpylons() {
amountValid := 10_000_000
amountOfCoinsTest := sdk.NewCoins(sdk.NewCoin(types.PylonsCoinDenom, sdk.NewInt(10_000_000)))

//create Google IAP order and test addresses
// create Google IAP order and test addresses
items := suite.SetUpGoogleIAPOrder(suite.Ctx, 2, productID)
testAddrs := suite.SetUpTestAddrs(5)

Expand All @@ -156,12 +156,12 @@ func (suite *UpgradeTestSuite) TestCleanUpylons() {
} {
tc := tc
suite.Run(tc.desc, func() {
//mint coin to test account
// mint coin to test account
for _, addr := range testAddrs {
err := suite.App.PylonsKeeper.MintCoinsToAddr(suite.Ctx, addr, amountOfCoinsTest)
suite.Require().NoError(err)
}
//mint valid coin
// mint valid coin
for _, item := range items {
addr, _ := sdk.AccAddressFromBech32(item.Creator)
amt := sdk.NewCoins(sdk.NewCoin(types.PylonsCoinDenom, sdk.NewInt(int64(tc.amount))))
Expand Down Expand Up @@ -289,12 +289,12 @@ func (suite *UpgradeTestSuite) TestRefundIAPNFTBUY() {
// setting IAP addresses as valid for IAP based refund
v4.IAPAddress[items[0].Creator] = true
v4.IAPAddress[items[1].Creator] = true
//mint coin to test account
// mint coin to test account
for _, addr := range testAddrs {
err := suite.App.PylonsKeeper.MintCoinsToAddr(suite.Ctx, addr, amountOfCoinsTest)
suite.Require().NoError(err)
}
//mint valid coin
// mint valid coin
for _, item := range items {
addr, _ := sdk.AccAddressFromBech32(item.Creator)
amt := sdk.NewCoins(sdk.NewCoin(types.PylonsCoinDenom, sdk.NewInt(int64(amountValid))))
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"cosmossdk.io/math"
"github.com/Pylons-tech/pylons/app/apptesting"
v5 "github.com/Pylons-tech/pylons/app/upgrades/v5"
v5 "github.com/Pylons-tech/pylons/app/upgrades/testnet/v5"
sdk "github.com/cosmos/cosmos-sdk/types"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
"github.com/stretchr/testify/suite"
Expand Down
22 changes: 22 additions & 0 deletions app/upgrades/testnet/v6/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v6

import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"

"github.com/Pylons-tech/pylons/app/upgrades"
)

const (
// UpgradeName is the shared upgrade plan name for mainnet and testnet
UpgradeName = "v1.1.1"
)

// TODO: Update StoreUpgrades

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
StoreUpgrades: storetypes.StoreUpgrades{
Added: []string{},
Deleted: []string{},
},
}
22 changes: 22 additions & 0 deletions app/upgrades/testnet/v6/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package v6

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
bankKeeper bankkeeper.Keeper,
accKeeper *authkeeper.AccountKeeper,
staking *stakingkeeper.Keeper,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return mm.RunMigrations(ctx, configurator, fromVM)
}
}
41 changes: 41 additions & 0 deletions buy-now/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
package-lock.json
/.pnp
.pnp.js
/.next

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*
.pnpm-debug.log*

# local env files
.env*.local
*.env
.env*
.env

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
18 changes: 18 additions & 0 deletions buy-now/@next/ApiReq/easelBuy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { requestUrl } from '@hooks'
import { AxiosResponse } from 'axios'

export const getRecipeHistory = async (
cookbookId: string,
recipeId: string
): Promise<AxiosResponse<unknown, any>> => {
return await requestUrl?.get(
`/pylons/get_recipe_history/${cookbookId}/${recipeId}`
)
}

export const getRecipeDetails = async (
cookbookId: string,
recipeId: string
): Promise<AxiosResponse<unknown, any>> => {
return await requestUrl?.get(`/pylons/recipe/${cookbookId}/${recipeId}`)
}
1 change: 1 addition & 0 deletions buy-now/@next/ApiReq/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './easelBuy'
Loading

0 comments on commit 13962d1

Please sign in to comment.