Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
125 commits
Select commit Hold shift + click to select a range
1dcb836
test: test deploy to server
nikita-misiura Jun 14, 2025
affd81c
fix: fix docker-compose path
nikita-misiura Jun 14, 2025
3634b2b
fix: fix docker-compose path
nikita-misiura Jun 14, 2025
6007a2d
fix: fix docker-compose path #1
nikita-misiura Jun 14, 2025
998586a
fix: fix docker-compose path #2
nikita-misiura Jun 14, 2025
6b2146d
fix(HOTFIX): add envs to compose
nikita-misiura Jun 14, 2025
726b6d8
fix(HOTFIX): add envs to compose #1
nikita-misiura Jun 14, 2025
29cbd0f
fix(HOTFIX): add envs to compose #2
nikita-misiura Jun 14, 2025
ec8844d
fix(HOTFIX): add envs to compose #3
nikita-misiura Jun 14, 2025
e57025a
feat(TAC-21): update node to main finally
nikita-misiura Jun 21, 2025
ee21872
draft: Register gTAC with x/erc20
a-romanenya-pixelplex Jun 23, 2025
0e7e05b
draft(FIX): Removed gTAC registration in app constructor
a-romanenya-pixelplex Jun 23, 2025
cc06b25
draft(FEAT): Added set token pair function into InitChainer
a-romanenya-pixelplex Jun 23, 2025
c95288c
fix: fix docker-compose path
nikita-misiura Jun 14, 2025
54e49a0
fix: fix docker-compose path #1
nikita-misiura Jun 14, 2025
362853e
fix: fix docker-compose path #2
nikita-misiura Jun 14, 2025
8cc4650
fix(HOTFIX): add envs to compose
nikita-misiura Jun 14, 2025
a2e369c
fix(HOTFIX): add envs to compose #1
nikita-misiura Jun 14, 2025
ae45d07
fix(HOTFIX): add envs to compose #2
nikita-misiura Jun 14, 2025
bf4ddcc
fix(HOTFIX): add envs to compose #3
nikita-misiura Jun 14, 2025
d19d79a
feat: Integrate “x/liquidstake” module
a-romanenya-pixelplex Jun 17, 2025
cb3a8d4
chore: Update Cosmos SDK
a-romanenya-pixelplex Jun 17, 2025
efb8cd7
refactor: Refactor x/liquidstake module
a-romanenya-pixelplex Jun 18, 2025
9be14d3
try to emplement liquid staking
Alexey-Ostrovsky Jun 20, 2025
b472084
(draft) fixing compatibility issues
Alexey-Ostrovsky Jun 20, 2025
ba99838
dependency cherry-picking
Alexey-Ostrovsky Jun 20, 2025
a7a7db3
draft: Merged from TAC-12
a-romanenya-pixelplex Jun 23, 2025
ec3918a
Merge branch 'TAC-20' into TAC-13
a-romanenya-pixelplex Jun 23, 2025
d9949d9
remove redunant tests
Alexey-Ostrovsky Jun 23, 2025
9dde47b
protogen fix
Alexey-Ostrovsky Jun 23, 2025
dbd83da
another fix on fix
Alexey-Ostrovsky Jun 23, 2025
c1ac062
error handling
Alexey-Ostrovsky Jun 23, 2025
9849dde
draft: added init function for erc20, x/liauidstake modules and chang…
a-romanenya-pixelplex Jun 24, 2025
529f949
fix docker build
Alexey-Ostrovsky Jun 25, 2025
42d5b8f
chore: remove needless log and updated Cosmos SDK module location in …
a-romanenya-pixelplex Jun 26, 2025
e1e375e
[TAC-46]: deploy localnode
nikita-misiura Jun 26, 2025
6a97f07
fix(HOTFIX): change deployed branch
nikita-misiura Jun 26, 2025
05d805f
feat(UPDATE): change built image
nikita-misiura Jun 26, 2025
a42cc84
feat(UPDATE): add libc6
nikita-misiura Jun 26, 2025
af81de9
feat(UPDATE): change runner tag
nikita-misiura Jun 26, 2025
70daa6e
feat(UPDATE): unchange runner tag
nikita-misiura Jun 26, 2025
4b27ec5
feat(UPDATE): add image
nikita-misiura Jun 26, 2025
f40dc0d
feat(UPDATE): expose necessary ports
nikita-misiura Jun 26, 2025
5ee0971
feat(UPDATE): expose necessary ports#!
nikita-misiura Jun 26, 2025
0af94b5
draft: added tests
a-romanenya-pixelplex Jun 26, 2025
7cc9f47
[TAC-46]: deploy second node
nikita-misiura Jun 30, 2025
a740b30
[TAC-46]: create initial genesis for both nodes
nikita-misiura Jun 30, 2025
66f35f0
Revert "[TAC-46]: create initial genesis for both nodes"
nikita-misiura Jun 30, 2025
f84b816
[TAC-46]: change node_id
nikita-misiura Jun 30, 2025
7f54ba8
[TAC-46]: deploy multi-node chain
nikita-misiura Jun 30, 2025
e5f912f
[TAC-46]: deploy multi-node chain #1
nikita-misiura Jun 30, 2025
f0d6362
[TAC-46]: deploy localchain with 4 node-validators
nikita-misiura Jun 30, 2025
e17bf39
feat: added web3Tx extension to implement eip-712 tx
a-romanenya-pixelplex Jul 8, 2025
1074440
Merge branch 'TAC-60' into localnet
a-romanenya-pixelplex Jul 9, 2025
cd91ec4
testing migration
Alexey-Ostrovsky Jun 30, 2025
e2c2e1a
rstore vote
Alexey-Ostrovsky Jul 1, 2025
4b395c5
few fixes
Alexey-Ostrovsky Jul 1, 2025
ef7b115
Merge branch 'migration_testing' into 'TAC-60'
Alexey-Ostrovsky Jul 9, 2025
23f2de9
draft: updated script for init multinode
a-romanenya-pixelplex Jul 9, 2025
21421b3
Merge branch 'localnet' into TAC-60
a-romanenya-pixelplex Jul 9, 2025
8ebbe07
fix(HOTFIX): add liquiedstake script do docker
nikita-misiura Jul 9, 2025
9681118
fix(HOTFIX): add liquiedstake script do docker #1
nikita-misiura Jul 9, 2025
4df4a48
fix(HOTFIX): change init-multi-node.sh script
nikita-misiura Jul 9, 2025
a7bc306
feat: upgraded cosmos evm for eip712
a-romanenya-pixelplex Jul 17, 2025
93b778d
chore: open grpc and rest ports
a-romanenya-pixelplex Jul 17, 2025
b84492a
chore: add ports to start script
a-romanenya-pixelplex Jul 17, 2025
09b665d
fix: grpc address
a-romanenya-pixelplex Jul 17, 2025
a5b52fe
fix(TAC-70): fix REST API port
SergeyAndreevPixel Jul 18, 2025
dd39b3c
fix(TAC-70): allow cors
SergeyAndreevPixel Jul 18, 2025
68af7d0
fix: update cosmos evm
a-romanenya-pixelplex Jul 18, 2025
7cbb7cb
Merge branch 'TAC-66' into localnet
a-romanenya-pixelplex Jul 18, 2025
79dfd14
chore: updated Dockerfile to download go modules before app building
a-romanenya-pixelplex Jul 18, 2025
a03c30c
Merge branch 'TAC-66' into localnet
a-romanenya-pixelplex Jul 18, 2025
9a40cde
Correct Net amount calculation logick
Alexey-Ostrovsky Jul 21, 2025
812b238
chore: reverted flags
a-romanenya-pixelplex Jul 22, 2025
7e092ed
draft: added tests
a-romanenya-pixelplex Jul 22, 2025
9bf0dd7
fix: added app helpers
a-romanenya-pixelplex Jul 22, 2025
7a17e67
feat: added epochs module and upgraded cosmos sdk
a-romanenya-pixelplex Jul 23, 2025
8ecad0f
draft: added tests
a-romanenya-pixelplex Jul 22, 2025
bfad412
fix: added app helpers
a-romanenya-pixelplex Jul 22, 2025
5db0431
feat: added epochs module and upgraded cosmos sdk
a-romanenya-pixelplex Jul 23, 2025
d19f94f
Merge branch 'localnet' into LSM_fixes
a-romanenya-pixelplex Jul 23, 2025
402b49c
Merge remote-tracking branch 'refs/remotes/origin/LSM_fixes' into LSM…
a-romanenya-pixelplex Jul 23, 2025
81fba24
fix: localnet-start script
a-romanenya-pixelplex Jul 23, 2025
92658f2
refactor: module variables renamed to TAC format
a-romanenya-pixelplex Jul 24, 2025
42b610b
draft: changed unbonding time
a-romanenya-pixelplex Jul 24, 2025
00fb48c
fix: changed unbonding time
a-romanenya-pixelplex Jul 24, 2025
599efd4
fix: changed unbonding time 2
a-romanenya-pixelplex Jul 24, 2025
a815e3e
Merge branch 'localnet' into TAC-84
a-romanenya-pixelplex Jul 24, 2025
15779f5
moving module to evm
Alexey-Ostrovsky Jul 31, 2025
449b1be
fix_dependency
Alexey-Ostrovsky Jul 31, 2025
9a8e6b9
change ci/cd
Alexey-Ostrovsky Jul 31, 2025
1dcbf29
fix generate genesis scripts
Alexey-Ostrovsky Aug 1, 2025
d9cabaa
return EIP typed data changes
Alexey-Ostrovsky Aug 1, 2025
11aee2d
Update Evm version to precompiles with events
Alexey-Ostrovsky Aug 4, 2025
6c39215
chore: set non-zero inflation
a-romanenya-pixelplex Aug 7, 2025
f36169b
chore: update ci
a-romanenya-pixelplex Aug 7, 2025
d1e895e
Sync with admin transaction changes: bf42d5628eca
Alexey-Ostrovsky Aug 8, 2025
9c47ab7
Revert EIP712 changes
Alexey-Ostrovsky Aug 8, 2025
4264ab6
Halborn audit fixes sync
Alexey-Ostrovsky Sep 16, 2025
f464ded
Prepare for proposal: remove redunant code after migrating module
Alexey-Ostrovsky Sep 18, 2025
5fa3780
Prepare for proposal: remove redunant scripts, move protocgen from se…
Alexey-Ostrovsky Sep 18, 2025
8b123c8
Prepare for proposal: remove unnescesssary ci parts and redunant modi…
Alexey-Ostrovsky Sep 18, 2025
8fe2f35
Prepare for proposal: reduce unnescescary changes in scripts
Alexey-Ostrovsky Sep 18, 2025
5bced55
Prepare for proposal: restore original params: inflation, gov proposa…
Alexey-Ostrovsky Sep 18, 2025
593e799
Prepare for proposal: fix, get back nescessary changes
Alexey-Ostrovsky Sep 18, 2025
e533c0d
Merge branch 'stage' into localnet
Alexey-Ostrovsky Sep 18, 2025
97381b3
Merge pull request #1 from pixelplex/localnet
Alexey-Ostrovsky Sep 18, 2025
bddba59
Prepare proposal
Alexey-Ostrovsky Sep 17, 2025
884c421
Sync with BeginBlock fix
Alexey-Ostrovsky Sep 17, 2025
d54cc64
Merge branch 'stage' into migration
Alexey-Ostrovsky Sep 18, 2025
497417a
Prepare proposal: minimize Dockerfile
Alexey-Ostrovsky Sep 18, 2025
4e774f8
sync with full wasm removal
Alexey-Ostrovsky Sep 19, 2025
e2943da
Prepare for proposal: Sync with test fixes in cosmos sdk
Alexey-Ostrovsky Sep 23, 2025
d0e679d
fix: go mod indirect ordering
Alexey-Ostrovsky Oct 10, 2025
2b80502
fix: v101 upgrade handler restore
Alexey-Ostrovsky Oct 10, 2025
5a48980
fix: go.mod ibc-go requrie section
Alexey-Ostrovsky Oct 10, 2025
a58ffda
fix: upgrade name to versioning convention
Alexey-Ostrovsky Oct 10, 2025
c891c6e
fix: remove redunant protobuf functionality
Alexey-Ostrovsky Oct 10, 2025
aabe557
fix: +x for script
Alexey-Ostrovsky Oct 10, 2025
5cc538b
feat: generilize init scripts for onde and for multi nodes
Alexey-Ostrovsky Oct 10, 2025
06623db
fix: remove redunant test utilities
Alexey-Ostrovsky Oct 10, 2025
cc95c36
feat: sync with dependency changes
Alexey-Ostrovsky Oct 10, 2025
5000685
fix: test localnet params
Alexey-Ostrovsky Oct 10, 2025
03aceb3
chore: add comments for replace in go mod
Alexey-Ostrovsky Oct 10, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
# docker build . -t tacchaind:latest
# docker run --rm -it tacchaind:latest tacchaind --help

FROM golang:1.23.8-alpine3.20 AS go-builder
FROM golang:1.23.8-bookworm AS go-builder

# this comes from standard alpine nightly file
# https://github.com/rust-lang/docker-rust-nightly/blob/master/alpine3.12/Dockerfile
# with some changes to support our toolchain, etc
RUN set -eux; apk add --no-cache ca-certificates build-base libusb-dev linux-headers;
RUN apt-get update && apt-get install -y \
ca-certificates \
build-essential \
libusb-1.0-0-dev \
libc6 \
&& rm -rf /var/lib/apt/lists/*

WORKDIR /code
COPY . /code/
Expand All @@ -15,7 +17,7 @@ RUN LEDGER_ENABLED=true make build


# --------------------------------------------------------
FROM alpine:3.18
FROM debian:bookworm-slim

COPY --from=go-builder /code/build/tacchaind /usr/bin/tacchaind

Expand Down
6 changes: 6 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ go.sum: go.mod
clean:
rm -rf build/

.PHONY: all install build build-windows-client go.sum clean

###############################################################################
### Tests ###
###############################################################################
Expand Down Expand Up @@ -121,6 +123,8 @@ test-ledger:
test-solidity:
./tests/solidity/run-solidity-tests.sh

.PHONY: test test-unit test-race test-e2e test-cover test-benchmark test-localnet-params test-localnet-evm test-ledger test-solidity

###############################################################################
### Networks ###
###############################################################################
Expand All @@ -139,3 +143,5 @@ localnet-init-multi-node:
localnet-start:
./contrib/localnet/start.sh

.PHONY: localnet-start localnet-init localnet-init-multi-node

67 changes: 66 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import (

abci "github.com/cometbft/cometbft/abci/types"
dbm "github.com/cosmos/cosmos-db"
"github.com/cosmos/evm/x/epochs"
epochskeeper "github.com/cosmos/evm/x/epochs/keeper"
epochstypes "github.com/cosmos/evm/x/epochs/types"
"github.com/cosmos/gogoproto/proto"
"github.com/cosmos/ibc-go/modules/capability"
capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper"
Expand Down Expand Up @@ -97,6 +100,7 @@ import (
authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module"
"github.com/cosmos/cosmos-sdk/x/bank"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"

banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"github.com/cosmos/cosmos-sdk/x/consensus"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
Expand Down Expand Up @@ -152,6 +156,10 @@ import (
evmibctransferkeeper "github.com/cosmos/evm/x/ibc/transfer/keeper"
evmvmkeeper "github.com/cosmos/evm/x/vm/keeper"
evmvmtypes "github.com/cosmos/evm/x/vm/types"

"github.com/cosmos/evm/x/liquidstake"
liquidstakekeeper "github.com/cosmos/evm/x/liquidstake/keeper"
liquidstaketypes "github.com/cosmos/evm/x/liquidstake/types"
)

// module account permissions
Expand All @@ -167,6 +175,8 @@ var maccPerms = map[string][]string{
ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner},
ibcfeetypes.ModuleName: nil,
icatypes.ModuleName: nil,
// liquidstake module
liquidstaketypes.ModuleName: {authtypes.Minter, authtypes.Burner},
// Cosmos EVM modules
evmvmtypes.ModuleName: {authtypes.Minter, authtypes.Burner},
evmfeemarkettypes.ModuleName: nil,
Expand Down Expand Up @@ -233,6 +243,10 @@ type TacChainApp struct {
// module configurator
configurator module.Configurator

EpochsKeeper *epochskeeper.Keeper
// liquidstake keeper
LiquidStakeKeeper liquidstakekeeper.Keeper

// Cosmos EVM keepers
FeeMarketKeeper evmfeemarketkeeper.Keeper
EVMKeeper *evmvmkeeper.Keeper
Expand Down Expand Up @@ -299,7 +313,9 @@ func NewTacChainApp(
authzkeeper.StoreKey, nftkeeper.StoreKey, group.StoreKey,
// non sdk store keys
capabilitytypes.StoreKey, ibcexported.StoreKey, ibctransfertypes.StoreKey, ibcfeetypes.StoreKey,
icahosttypes.StoreKey, icacontrollertypes.StoreKey,
icahosttypes.StoreKey, epochstypes.StoreKey, icacontrollertypes.StoreKey,
// liquidstake module
liquidstaketypes.StoreKey,
// Cosmos EVM store keys
evmvmtypes.StoreKey, evmfeemarkettypes.StoreKey, evmerc20types.StoreKey,
)
Expand Down Expand Up @@ -545,6 +561,28 @@ func NewTacChainApp(
// If evidence needs to be handled for the app, set routes in router here and seal
app.EvidenceKeeper = *evidenceKeeper

app.EpochsKeeper = epochskeeper.NewKeeper(keys[epochstypes.StoreKey])

// liquidstake keeper
app.LiquidStakeKeeper = liquidstakekeeper.NewKeeper(
encodingConfig.Codec,
keys[liquidstaketypes.StoreKey],
app.AccountKeeper,
app.BankKeeper,
*app.StakingKeeper,
app.MintKeeper,
app.DistrKeeper,
app.SlashingKeeper,
app.MsgServiceRouter(),
authAddr,
)

app.EpochsKeeper.SetHooks(
epochstypes.NewMultiEpochHooks(
app.LiquidStakeKeeper.EpochHooks(),
),
)

// Cosmos EVM keepers
app.FeeMarketKeeper = evmfeemarketkeeper.NewKeeper(
encodingConfig.Codec, authtypes.NewModuleAddress(govtypes.ModuleName),
Expand Down Expand Up @@ -677,6 +715,7 @@ func NewTacChainApp(
app.GovKeeper,
app.SlashingKeeper,
app.EvidenceKeeper,
app.LiquidStakeKeeper,
),
)

Expand Down Expand Up @@ -707,6 +746,7 @@ func NewTacChainApp(
upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()),
evidence.NewAppModule(app.EvidenceKeeper),
params.NewAppModule(app.ParamsKeeper),
epochs.NewAppModule(*app.EpochsKeeper),
authzmodule.NewAppModule(encodingConfig.Codec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
groupmodule.NewAppModule(encodingConfig.Codec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
nftmodule.NewAppModule(encodingConfig.Codec, app.NFTKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry),
Expand All @@ -719,6 +759,8 @@ func NewTacChainApp(
ibcfee.NewAppModule(app.IBCFeeKeeper),
ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper),
ibctm.AppModule{},
// liquidstake module
liquidstake.NewAppModule(app.LiquidStakeKeeper),
// sdk
crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them
// Cosmos EVM modules
Expand Down Expand Up @@ -760,6 +802,9 @@ func NewTacChainApp(
capabilitytypes.ModuleName,
distrtypes.ModuleName,
stakingtypes.ModuleName,
epochstypes.ModuleName,
// liquidstake module after staking
liquidstaketypes.ModuleName,
slashingtypes.ModuleName,
minttypes.ModuleName,
ibcexported.ModuleName,
Expand Down Expand Up @@ -799,7 +844,9 @@ func NewTacChainApp(
feegrant.ModuleName,
group.ModuleName,
// no-op modules
epochstypes.ModuleName,
stakingtypes.ModuleName,
liquidstaketypes.ModuleName,
ibctransfertypes.ModuleName,
ibcexported.ModuleName,
icatypes.ModuleName,
Expand Down Expand Up @@ -840,6 +887,9 @@ func NewTacChainApp(
ibcexported.ModuleName,
icatypes.ModuleName,
ibcfeetypes.ModuleName,
epochstypes.ModuleName,
// liquidstake module
liquidstaketypes.ModuleName,

// Cosmos EVM modules
//
Expand Down Expand Up @@ -1028,6 +1078,7 @@ func (app *TacChainApp) InitChainer(ctx sdk.Context, req *abci.RequestInitChain)
if err != nil {
panic(err)
}

response, err := app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState)
return response, err
}
Expand Down Expand Up @@ -1088,12 +1139,26 @@ func (app *TacChainApp) AutoCliOpts() autocli.AppOptions {
func (app *TacChainApp) DefaultGenesis() map[string]json.RawMessage {
genesis := app.BasicModuleManager.DefaultGenesis(app.appCodec)

// Mint denom configuration
mintGenState := minttypes.DefaultGenesisState()
mintGenState.Params.MintDenom = BaseDenom
genesis[minttypes.ModuleName] = app.appCodec.MustMarshalJSON(mintGenState)

// EVM genesis configuration
evmGenState := evmd.NewEVMGenesisState()
evmGenState.Params.ActiveStaticPrecompiles = evmvmtypes.AvailableStaticPrecompiles
genesis[evmvmtypes.ModuleName] = app.appCodec.MustMarshalJSON(evmGenState)

// ERC20 genesis configuration
erc20GenState := evmerc20types.DefaultGenesisState()
erc20GenState.Params.EnableErc20 = true
genesis[evmerc20types.ModuleName] = app.appCodec.MustMarshalJSON(erc20GenState)

// Liquidstake
lsGenState := liquidstaketypes.DefaultGenesisState()
lsGenState.Params.ModulePaused = false
genesis[liquidstaketypes.ModuleName] = app.appCodec.MustMarshalJSON(lsGenState)

return genesis
}

Expand Down
1 change: 1 addition & 0 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,4 @@ func NewTacChainAppWithCustomOptions(t *testing.T, isCheckTx bool, invCheckPerio

return app
}

5 changes: 5 additions & 0 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
v0011 "github.com/Asphere-xyz/tacchain/app/upgrades/v0.0.11"
v009 "github.com/Asphere-xyz/tacchain/app/upgrades/v0.0.9"
v101 "github.com/Asphere-xyz/tacchain/app/upgrades/v1.0.1"
v102 "github.com/Asphere-xyz/tacchain/app/upgrades/v1.0.2"
)

// Upgrades list of chain upgrades
Expand All @@ -18,6 +19,7 @@ var Upgrades = []upgrades.Upgrade{
v0010.Upgrade,
v0011.Upgrade,
v101.Upgrade,
v102.Upgrade, // liquid stake
}

// RegisterUpgradeHandlers registers the chain upgrade handlers
Expand All @@ -30,6 +32,9 @@ func (app *TacChainApp) RegisterUpgradeHandlers() {
IBCKeeper: app.IBCKeeper,
Codec: app.appCodec,
GetStoreKey: app.GetKey,
LiquidStakeKeeper: &app.LiquidStakeKeeper,
BankKeeper: app.BankKeeper,
Erc20Keeper: &app.Erc20Keeper,
}
app.GetStoreKeys()
// register all upgrade handlers
Expand Down
7 changes: 7 additions & 0 deletions app/upgrades/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ import (
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"

bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
evmerc20keeper "github.com/cosmos/evm/x/erc20/keeper"
liquidstakekeeper "github.com/cosmos/evm/x/liquidstake/keeper"
)

type AppKeepers struct {
Expand All @@ -24,6 +28,9 @@ type AppKeepers struct {
GetStoreKey func(storeKey string) *storetypes.KVStoreKey
CapabilityKeeper *capabilitykeeper.Keeper
IBCKeeper *ibckeeper.Keeper
LiquidStakeKeeper *liquidstakekeeper.Keeper
BankKeeper bankkeeper.Keeper
Erc20Keeper *evmerc20keeper.Keeper
}

type ModuleManager interface {
Expand Down
32 changes: 32 additions & 0 deletions app/upgrades/v1.0.2/constants.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package v102

// Upgrade for implementing liquid stake module

import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)

const (
LsmBondDenom = "stk/utac"
DisplayDenom = "gTAC"
)

var GTACMetadata = banktypes.Metadata{
Description: "Liquid Staked TAC token",
DenomUnits: []*banktypes.DenomUnit{
{
Denom: LsmBondDenom,
Exponent: 0,
},
{
Denom: DisplayDenom,
Exponent: 18,
},
},
Base: LsmBondDenom,
Display: DisplayDenom,
Name: "Gravity TAC",
Symbol: "gTAC",
URI: "",
URIHash: "",
}
74 changes: 74 additions & 0 deletions app/upgrades/v1.0.2/upgrades.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
package v102

// Upgrade for implementing liquid stake module

import (
"context"

storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/Asphere-xyz/tacchain/app/upgrades"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
evmerc20types "github.com/cosmos/evm/x/erc20/types"

"github.com/ethereum/go-ethereum/common"
"golang.org/x/crypto/sha3"

)

// UpgradeName defines the on-chain upgrade name
const UpgradeName = "v1.0.2"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
CreateUpgradeHandler: CreateUpgradeHandler,
StoreUpgrades: storetypes.StoreUpgrades{
Added: []string{"utacliquidstake", "epochs"},
Comment thread
tgntr marked this conversation as resolved.
Deleted: []string{},
},
}

func generateAddressFromDenom(denom string) (common.Address, error) {
hash := sha3.NewLegacyKeccak256()
if _, err := hash.Write([]byte(denom)); err != nil {
return common.Address{}, err
}
return common.BytesToAddress(hash.Sum(nil)), nil
}

func CreateUpgradeHandler(
mm upgrades.ModuleManager,
configurator module.Configurator,
ak *upgrades.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx context.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
newVM, err := mm.RunMigrations(ctx, configurator, fromVM)
if err != nil {
return newVM, err
}

sdkCtx := sdk.UnwrapSDKContext(ctx)

// Register gTAC token pair
lsmBondDenom := ak.LiquidStakeKeeper.LiquidBondDenom(sdkCtx)
lsmBondCommonAddress, err := generateAddressFromDenom(lsmBondDenom)
if err != nil {
return newVM, err
}
ak.BankKeeper.SetDenomMetaData(ctx, GTACMetadata)

erc20Params := ak.Erc20Keeper.GetParams(sdkCtx)
erc20Params.NativePrecompiles = append(erc20Params.NativePrecompiles, lsmBondCommonAddress.String())
if err := ak.Erc20Keeper.SetParams(sdkCtx, erc20Params); err != nil {
return newVM, err
}

lsmTokenPair := evmerc20types.NewTokenPair(lsmBondCommonAddress, lsmBondDenom, evmerc20types.OWNER_MODULE)

ak.Erc20Keeper.SetToken(sdkCtx, lsmTokenPair)

return newVM, nil
}
}
Loading
Loading