Skip to main content

Core Modules

RP1 is built from specialized modules that work together to provide a complete DeFi platform.

Module Architecture

┌─────────────────────────────────────────────────────────────┐
│ Core Modules │
├──────────┬──────────┬──────────┬──────────┬────────────────┤
│ Privacy │ UTA │InstaWrap │ Lending │ Oracle │
│ Shield │ Margin │ Bridge │ Borrow │ Prices │
├──────────┴──────────┴──────────┴──────────┴────────────────┤
│ Supporting Modules │
├──────────┬──────────┬──────────┬──────────┬────────────────┤
│ DEX │ Fee Burn │ EVM │ Halving │ Liquidity │
│ AMM │ 50% │ Solidity │ Emission │ Mining │
└──────────┴──────────┴──────────┴──────────┴────────────────┘

Module Summary

ModulePurposeKey Features
PrivacyShielded transactionszkSNARK proofs, viewing keys
UTAUnified Trading AccountMargin trading, perpetuals
InstaWrapCross-chain bridgeInstant BTC/ETH/SOL wrapping
LendingBorrow/lend marketsCollateralized loans, liquidations
OraclePrice feedsTWAP, validator voting
Fee BurnDeflationary mechanism50% of fees burned
DEXToken swapsAMM pools, shielded swaps
EVMSmart contractsSolidity compatibility
HalvingToken emissionBitcoin-style halving
LiquidityLP rewardsMining incentives

Module Interactions

DeFi Flow Example

1. User wraps BTC via InstaWrap
└── Receives wBTC instantly (LP-backed)

2. User shields wBTC in Privacy module
└── wBTC becomes private

3. User supplies shielded wBTC to Lending
└── Earns interest, can borrow against it

4. User opens leveraged position in UTA
└── Borrows against Lending collateral

5. Oracle provides price feeds throughout
└── Used for liquidations, margins, swaps

Fee Distribution

Transaction Fee: 100 RP1

├── 50% burned (Fee Burn module)
│ └── 50 RP1 permanently removed

└── 50% to validators/stakers
└── 50 RP1 distributed as rewards

Creating Custom Modules

RP1 follows Cosmos SDK module patterns:

// Define your module
type AppModule struct {
keeper Keeper
}

// Implement required interfaces
func (am AppModule) Name() string { return "mymodule" }

func (am AppModule) RegisterServices(cfg module.Configurator) {
types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper))
types.RegisterQueryServer(cfg.QueryServer(), keeper.NewQuerier(am.keeper))
}

// Genesis handling
func (am AppModule) InitGenesis(ctx sdk.Context, cdc codec.JSONCodec, data json.RawMessage) {
var genesis types.GenesisState
cdc.MustUnmarshalJSON(data, &genesis)
am.keeper.InitGenesis(ctx, &genesis)
}

Module Governance

Key module parameters are adjustable via governance:

ModuleGovernable Parameters
PrivacyRing size, proof requirements
UTAMax leverage, liquidation threshold
LendingInterest rates, collateral factors
OracleUpdate frequency, deviation threshold
Fee BurnBurn percentage
# Submit parameter change proposal
rp1d tx gov submit-proposal param-change proposal.json \
--from validator \
--chain-id rp1-1

Next Steps