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
| Module | Purpose | Key Features |
|---|---|---|
| Privacy | Shielded transactions | zkSNARK proofs, viewing keys |
| UTA | Unified Trading Account | Margin trading, perpetuals |
| InstaWrap | Cross-chain bridge | Instant BTC/ETH/SOL wrapping |
| Lending | Borrow/lend markets | Collateralized loans, liquidations |
| Oracle | Price feeds | TWAP, validator voting |
| Fee Burn | Deflationary mechanism | 50% of fees burned |
| DEX | Token swaps | AMM pools, shielded swaps |
| EVM | Smart contracts | Solidity compatibility |
| Halving | Token emission | Bitcoin-style halving |
| Liquidity | LP rewards | Mining 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:
| Module | Governable Parameters |
|---|---|
| Privacy | Ring size, proof requirements |
| UTA | Max leverage, liquidation threshold |
| Lending | Interest rates, collateral factors |
| Oracle | Update frequency, deviation threshold |
| Fee Burn | Burn percentage |
# Submit parameter change proposal
rp1d tx gov submit-proposal param-change proposal.json \
--from validator \
--chain-id rp1-1
Next Steps
- Privacy Module - Shielded transactions
- InstaWrap Module - Cross-chain bridging
- UTA Module - Margin trading
- Lending Module - Borrow/lend