🌅
Sunrise / Gluon Docs
  • Home
    • 👋Sunrise
  • 📜Learn
    • 🌆Sunrise
      • Proof of Liquidity
      • Fee Abstraction
      • Data Availability
      • Gauges Voting
      • Liquidity Pool
      • Liquidity Incentive
      • Swap
      • TokenConverter
      • Fee
      • Lockup Account
      • Bribes
    • 💴$RISE
      • Allocations
    • 🏦Gluon
    • 💴$GLU
    • 🎓Thesis
      • App chain thesis
      • Interoperability
  • 🛠️Build
    • 🚀Quick Start
    • Client
    • L2 Blockchains
      • Rollkit
        • Sunrise Data
        • Rollkit L2 Chain
      • OP Stack
        • Sunrise Data
        • OP Stack L2 Chain
    • Validators
      • Proof of Data Availability
      • Self Delegation
  • 🏗️Run a Sunrise Node
    • Networks
    • Types of Nodes
      • Consensus
        • Full Consensus Node
        • Validator Node (Genesis)
        • Validator Node
        • Setup Cosmovisor
      • IBC Relayers
    • Resources
      • Upgrade
      • Environment
  • 🏗️Run a Gluon Node
    • Networks
    • Node
      • Validator Node
  • 🔗Links
    • GitHub
    • Discord
    • X (Twitter)
    • Medium
    • dev.to
  • 📓Deprecated (UnUniFi)
    • IBC Channels
    • Security
    • CosmWasm
      • Tutorial
      • Create Project
    • IYA Strategy
      • Interface
      • External CosmWasm chain with IBCHooks
      • External EVM chain with Axelar
    • Frontend
      • Cosmos Client TS
    • Resources
    • Setup ununifid
    • ununifid
      • Basic Commands
      • Module Commands
        • wasm
    • Build a Node
    • Build a Validator Node
    • Setup Cosmovisor
    • Mainnet Upgrades
    • IBC Relayer
Powered by GitBook
On this page
  • Key Features
  • Core Functionality
  • Token Conversion
  • Workflow: Token Conversion Process
  • Messages
  • MsgConvert
  • Example Usage
  • Benefits
  1. Learn
  2. Sunrise

TokenConverter

The x/tokenconverter module enables seamless conversion between vRISE and RISE tokens on the Sunrise blockchain. This module plays a crucial role in the ecosystem by allowing users to convert between the staking token and the fee token while maintaining an equivalent value relationship.

Key Features

  1. Bidirectional Token Conversion:

    • Convert vRISE (bond denomination) to RISE (fee denomination) and vice versa.

    • Maintain a 1:1 equivalent value relationship between the tokens.

  2. Parameter Governance:

    • Configurable denominations through module parameters.

    • Default bond denomination: "uvRISE" (micro vRISE).

    • Default fee denomination: "urise" (micro RISE).

  3. Integrated System Component:

    • Works alongside other modules like x/shareclass and x/fee.

    • Supports the broader tokenomics of the Sunrise ecosystem.

  4. Permissionless Operation:

    • Any user can perform token conversions at any time.

    • No slippage or fees applied to the conversion process.

Core Functionality

Note: The following section covers advanced topics intended for experienced users or developers.

Token Conversion

The module provides a simple and direct conversion mechanism between vRISE and RISE tokens:

  • When converting vRISE to RISE, the module burns vRISE and mints an equivalent amount of RISE.

  • When converting RISE to vRISE, the module burns RISE and mints an equivalent amount of vRISE.

This process maintains the total economic value in the system while allowing users to hold the token type that best suits their needs.

Workflow: Token Conversion Process

Note: The following section covers advanced topics intended for experienced users or developers.

Messages

MsgConvert

Converts tokens between the bond and fee denominations.

type MsgConvert struct {
    Sender  string
    Amount  string
}

Parameter Configuration

Note: The following section covers advanced topics intended for experienced users or developers.

Parameter
Description

Bond Denomination (bond_denom)

The denomination used for staking and governance (default: "uvRISE").

Fee Denomination (fee_denom)

The denomination used for transaction fees (default: "urise").

Example Configuration:

{
  "bond_denom": "uvRISE",
  "fee_denom": "urise"
}

Example Usage

LEVEL 1: FOR APP DEVELOPERS

Query Token Converter Parameters

import { SunriseClient } from "@sunriselayer/client";

async function queryTokenConverterParams() {
    const client = await SunriseClient.connect("https://rpc.sunriselayer.io");
    const queryClient = client.getQueryClient();

    if (!queryClient) {
        console.error("Query client not initialized");
        return;
    }

    const params = await queryClient.tokenconverter.params({});
    console.log("Token Converter Parameters:", params.params);
}

Convert Tokens

import { SunriseClient } from "@sunriselayer/client";
import { MsgConvert } from "@sunriselayer/client/types";

async function convertTokens() {
    const client = await SunriseClient.connect("https://rpc.sunriselayer.io");
    
    // Convert 1 vRISE to RISE
    const msgConvert = {
        sender: "sunrise1...",
        amount: "1000000"  // 1 vRISE (in micro units)
    };
    
    const result = await client.executeTransaction(msgConvert);
    console.log("Conversion result:", result);
}

Benefits

  1. Flexible Token Usage:

    • Users can hold tokens in their preferred denomination.

    • Seamlessly switch between tokens based on intended use (staking vs fees).

  2. Ecosystem Integration:

    • Supports the DA Fee Abstraction mechanism by allowing conversion between token types.

    • Facilitates the operation of other modules in the Sunrise ecosystem.

  3. Simple Design:

    • Straightforward conversion with no fees or slippage.

    • Easy to understand and integrate with applications.

PreviousSwapNextFee

Last updated 7 days ago

See for details.

📜
🌆
Github