Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
alienc0der committed Jun 8, 2024
1 parent eb74457 commit 68fe071
Show file tree
Hide file tree
Showing 12 changed files with 44 additions and 40 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags))

# process linker flags
ldflags += -X github.com/cosmos/cosmos-sdk/version.Name=cronos \
-X github.com/cosmos/cosmos-sdk/version.AppName=cronosd \
-X github.com/cosmos/cosmos-sdk/version.AppName=supernovad \
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \
-X github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)
Expand All @@ -93,7 +93,7 @@ endif

all: build
build: check-network print-ledger go.sum
@go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/cronosd ./cmd/cronosd
@go build -mod=readonly $(BUILD_FLAGS) -o $(BUILDDIR)/supernovad ./cmd/cronosd

install: check-network print-ledger go.sum
@go install -mod=readonly $(BUILD_FLAGS) ./cmd/cronosd
Expand Down
9 changes: 2 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ parent:


<div align="center">
<h1> <img src="./assets/cronos.svg" alt="Cronos Logo" width="300px" /> </h1>
<h1> <img src="https://zenon.org/images/contents/phases/getting-started/network-of-momentum.png" alt="Zenon" width="240px" /> </h1>
</div>
<br />

Expand Down Expand Up @@ -39,7 +39,7 @@ parent:

## 1. Description

**Cronos** is the Crypto.org EVM chain that aims to massively scale the DeFi ecosystem.
**Supernova** is the first Zenon EVM based extension-chain.

<a id="contributing" />

Expand Down Expand Up @@ -163,11 +163,6 @@ pystarport supervisorctl stop all

## 10. Useful links

- [Project Website](http://cronos.org/)
- [Technical Documentation](http://cronos.org/docs)
- Community chatrooms (non-technical): [Discord](https://discord.gg/nsp9JTC) [Telegram](https://t.me/CryptoComOfficial)
- Developer community channel (technical): [![Support Server](https://img.shields.io/discord/783264383978569728.svg?color=7289da&label=Cronos&logo=discord&style=flat-square)](https://discord.gg/pahqHz26q4)
- [Ethermint](https://github.com/evmos/ethermint) by Tharsis
- [Cosmos SDK documentation](https://docs.cosmos.network)
- [Cosmos Discord](https://discord.gg/W8trcGV)
- [Pystarport](https://github.com/crypto-com/pystarport/blob/main/README.md)
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,9 @@ import (
_ "github.com/ethereum/go-ethereum/eth/tracers/native"
)

// EXTENSION-CHAIN
const (
Name = "cronos"
Name = "supernova"

// AddrLen is the allowed length (in bytes) for an address.
//
Expand Down
22 changes: 0 additions & 22 deletions assets/cronos.svg

This file was deleted.

3 changes: 2 additions & 1 deletion cmd/cronosd/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ func NewRootCmd() *cobra.Command {
panic(err)
}

// EXTENSION-CHAIN
rootCmd := &cobra.Command{
Use: app.Name + "d",
Short: "Cronos Daemon",
Short: "Supernova Daemon",
PersistentPreRunE: func(cmd *cobra.Command, _ []string) error {
// set the default command outputs
cmd.SetOut(cmd.OutOrStdout())
Expand Down
3 changes: 2 additions & 1 deletion cmd/cronosd/config/prefix_mainnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ package config
import sdk "github.com/cosmos/cosmos-sdk/types"

const (
// EXTENSION-CHAIN
// Bech32Prefix defines the Bech32 prefix used for Cronos Accounts
Bech32Prefix = "crc"
Bech32Prefix = "x"

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Bech32PrefixAccAddr = Bech32Prefix
Expand Down
3 changes: 2 additions & 1 deletion cmd/cronosd/config/prefix_testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ package config
import sdk "github.com/cosmos/cosmos-sdk/types"

const (
// EXTENSION-CHAIN
// Bech32Prefix defines the Bech32 prefix used for Cronos Accounts
Bech32Prefix = "tcrc"
Bech32Prefix = "tx"

// Bech32PrefixAccAddr defines the Bech32 prefix of an account's address
Bech32PrefixAccAddr = Bech32Prefix
Expand Down
2 changes: 1 addition & 1 deletion x/cronos/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ func GetTxCmd() *cobra.Command {
cmd.AddCommand(CmdConvertTokens())
cmd.AddCommand(CmdSendToCryptoOrg())
cmd.AddCommand(CmdUpdateTokenMapping())
cmd.AddCommand(CmdTurnBridge())
// cmd.AddCommand(CmdTurnBridge())
cmd.AddCommand(CmdUpdatePermissions())
cmd.AddCommand(MigrateGenesisCmd())
return cmd
Expand Down
16 changes: 16 additions & 0 deletions x/cronos/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,22 @@ func (k msgServer) UpdateTokenMapping(goCtx context.Context, msg *types.MsgUpdat
// TurnBridge implements the grpc method
func (k msgServer) TurnBridge(goCtx context.Context, msg *types.MsgTurnBridge) (*types.MsgTurnBridgeResponse, error) {
return nil, nil

// EXTENSION-CHAIN
// Disable TurnBridge
return nil, errors.Wrap(sdkerrors.ErrUnauthorized, "msg sender is not authorized")
// ctx := sdk.UnwrapSDKContext(goCtx)

// check permission
// if !k.Keeper.HasPermission(ctx, msg.GetSigners(), CanTurnBridge) {
// return nil, errors.Wrap(sdkerrors.ErrUnauthorized, "msg sender is not authorized")
// }

// gravityParams := k.gravityKeeper.GetParams(ctx)
// gravityParams.BridgeActive = msg.Enable
// k.gravityKeeper.SetParams(ctx, gravityParams)

// return &types.MsgTurnBridgeResponse{}, nil
}

func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) {
Expand Down
1 change: 1 addition & 0 deletions x/cronos/simulation/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/crypto-org-chain/cronos/v2/x/cronos/types"
)

// EXTENSION-CHAIN
const (
ibcCroDenomKey = "ibc_cro_denom"
ibcTimeoutKey = "ibc_timeout"
Expand Down
7 changes: 6 additions & 1 deletion x/cronos/types/params.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,12 @@ var (
KeyMaxCallbackGas = []byte("MaxCallbackGas")
)

// EXTENSION-CHAIN
const (
IbcCroDenomDefaultValue = "ibc/6B5A664BF0AF4F71B2F0BAA33141E2F1321242FBD5D19762F541EC971ACB0865"
// hash() representing a SHA256 hashing function returning a string
// ibc_denom := 'ibc/' + hash('path' + 'base_denom')
// sha256(transfer/channel-0/xznn) = 7C17F42EA0A975EA77611A8084EA11B1DF651E67C16C4AE6F99340566B04FDD1
IbcCroDenomDefaultValue = "ibc/7C17F42EA0A975EA77611A8084EA11B1DF651E67C16C4AE6F99340566B04FDD1"
IbcTimeoutDefaultValue = uint64(86400000000000) // 1 day
MaxCallbackGasDefaultValue = uint64(50000)
)
Expand All @@ -45,6 +49,7 @@ func NewParams(ibcCroDenom string, ibcTimeout uint64, cronosAdmin string, enable
}

// DefaultParams is the default parameter configuration for the cronos module
// EXTENSION-CHAIN
func DefaultParams() Params {
return Params{
IbcCroDenom: IbcCroDenomDefaultValue,
Expand Down
11 changes: 8 additions & 3 deletions x/cronos/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ var (
TenPowTen = Ten.Exp(Ten, Ten, nil)
)

// EXTENSION-CHAIN
const (
ibcDenomPrefix = "ibc/"
ibcDenomLen = len(ibcDenomPrefix) + 64
gravityDenomPrefix = "gravity0x"
gravityDenomLen = len(gravityDenomPrefix) + 40
cronosDenomPrefix = "cronos0x"
cronosDenomLen = len(cronosDenomPrefix) + 40
cronosDenomPrefix = "x0x"
// cronosDenomPrefix = "cronos0x"
cronosDenomLen = len(cronosDenomPrefix) + 40
)

// IsValidIBCDenom returns true if denom is a valid ibc denom
Expand Down Expand Up @@ -53,7 +55,10 @@ func GetContractAddressFromDenom(denom string) (string, error) {
if strings.HasPrefix(denom, gravityDenomPrefix) {
contractAddress = denom[7:]
} else if strings.HasPrefix(denom, cronosDenomPrefix) {
contractAddress = denom[6:]

// EXTENSION-CHAIN
contractAddress = denom[1:]
// contractAddress = denom[6:]
}
if !common.IsHexAddress(contractAddress) {
return "", fmt.Errorf("invalid contract address (%s)", contractAddress)
Expand Down

0 comments on commit 68fe071

Please sign in to comment.