Integrate the Alliance module
Alliance can be integrated into both new and existing blockchains. It is an isolated module that doesnโt modify any existing CosmosSDK code. New blockchains can simply import the module and existing chains can perform a software upgrade.
To connect with a member of the Alliance team for questions regarding integration, setting Alliance asset parameters, or other items, please complete this form.
Follow all of the steps in this guide carefully.
Chains that want to create an Alliance must enable the following modules:
- x/auth: retrieve information about internal blockchain accounts
- x/bank: mint, burn or send coins
- x/staking: bond, unbond, delegate tokens and hooks
- x/distribution: withdraw rewards
- x/gov: create Alliances through governance
The Alliance module leverages the IBC module to bridge foreign tokens and the Token Factory module to mint native tokens. Alliance allows any native token recognized by the bank module to be staked as long as it has been whitelisted. CW-20 tokens sent via IBC from other chains can be used in the Alliance module if they are minted as native tokens.
Prerequisitesโ
The Alliance Module requires:
- Cosmos SDK v0.47.x or greater
- The following fully-operational modules:
Configuring and Adding Alliance to a Cosmos SDK Chainโ
Refer to the example pull request for an implementation of the following steps.
- Add the Alliance package to the
go.mod
file with the latest released version and install it.
- Add the following modules to
app.go
- Register the AllianceKeeper in
App struct
.
- Add the Alliance module into the BasicManager instantiation.
- Add the Alliance module to the app. The Alliance module needs to be specified after the
stakingKeeper
is instantiated.
- Add the Alliance staking hooks to
app.StakingKeeper
.
- Add the requisite Alliance module types to the module account permissions.
- Add the alliance storekey to the KVStore.
- Add the Alliance module to the app manager and simulation manager instantiations.
- Add the module as the final element to the following:
SetOrderBeginBlockers
SetOrderEndBlockers
SetOrderInitGenesis
- Add the Alliance proposal handler route to the governance module.
- Add the governance proposal handlers.
- Block the module account address.
- Add the init params keepers.
Configuring the Bank Moduleโ
Make sure all three of the following steps are implemented.
Because the Alliance module mints and burns native staking tokens when rebalancing reward power, a chain's Total Supply API needs to be updated to return accurate results. This custom wrapper only affects the following APIs: /cosmos/bank/v1beta1/supply
& /cosmos/bank/v1beta1/supply/by_denom
. Follow these instructions to update your API for supply accuracy.
- Update the imports to use a custom wrapper over the Bank module.
- Add a line to register the keepers that the custom Bank module needs.
- Add the following keeper to allow the Alliance module access to transfer tokens directly to accounts.
Specify the fee collector module accountโ
The following steps allow you to specify a fee collector account, allowing for more flexibility in configuration. If you don't want to specify a custom fee collector, specify the default fee collector.
- Add
authtypes.FeeCollectorName,
to theAllianceKeeper
inapp.go
.
- Add the following line to specify the fee collector. If you don't want to specify a custom fee collector, specify the default
FeeCollector
.