Skip to content

Bank Polaris ‚Äč

Git Source

The bank precompile serves an interface to the Cosmos SDK Bank module, which is responsible for managing coin transfers and balances. The interface defines various events and methods to interact with the bank module.

Note: Link to existing contract ABI's can be found on Github here.

Interface of all supported Cosmos events emitted by the bank module

Functions ‚Äč

getBalance ‚Äč

If the denomination is not found, returns 0

Returns the amount of account balance by address for a given coin denomination

solidity
function getBalance(address accountAddress, string calldata denom) external view returns (uint256);
function getBalance(address accountAddress, string calldata denom) external view returns (uint256);

getAllBalances ‚Äč

If the account address is not found, returns an empty array

Returns account balance by address for all denominations

solidity
function getAllBalances(address accountAddress) external view returns (Cosmos.Coin[] memory);
function getAllBalances(address accountAddress) external view returns (Cosmos.Coin[] memory);

getSpendableBalance ‚Äč

If the denomination is not found, returns 0

Returns the amount of account balance by address for a given coin denomination

solidity
function getSpendableBalance(address accountAddress, string calldata denom) external view returns (uint256);
function getSpendableBalance(address accountAddress, string calldata denom) external view returns (uint256);

getAllSpendableBalances ‚Äč

If the account address is not found, returns an empty array

Returns account balance by address for all coin denominations

solidity
function getAllSpendableBalances(address accountAddress) external view returns (Cosmos.Coin[] memory);
function getAllSpendableBalances(address accountAddress) external view returns (Cosmos.Coin[] memory);

getSupply ‚Äč

Returns the total supply of a single coin

solidity
function getSupply(string calldata denom) external view returns (uint256);
function getSupply(string calldata denom) external view returns (uint256);

getAllSupply ‚Äč

Returns the total supply of a all coins

solidity
function getAllSupply() external view returns (Cosmos.Coin[] memory);
function getAllSupply() external view returns (Cosmos.Coin[] memory);

send ‚Äč

If the sender does not have enough balance, returns false

Send coins from msg.sender to another

solidity
function send(address toAddress, Cosmos.Coin[] calldata amount) external payable returns (bool);
function send(address toAddress, Cosmos.Coin[] calldata amount) external payable returns (bool);

Parameters

NameTypeDescription
toAddressaddressThe recipient address
amountCosmos.Coin[]The amount of Cosmos coins to send

Events ‚Äč

Transfer ‚Äč

Emitted by the bank module when amount tokens are sent to recipient

solidity
event Transfer(address indexed recipient, Cosmos.Coin[] amount);
event Transfer(address indexed recipient, Cosmos.Coin[] amount);

Parameters

NameTypeDescription
recipientaddressThe recipient address
amountCosmos.Coin[]The amount of Cosmos coins sent

Message ‚Äč

Emitted by the bank module when sender sends some amount of tokens

solidity
event Message(address indexed sender);
event Message(address indexed sender);

Parameters

NameTypeDescription
senderaddressThe sender address

CoinSpent ‚Äč

Emitted by the bank module when amount tokens are spent by spender

solidity
event CoinSpent(address indexed spender, Cosmos.Coin[] amount);
event CoinSpent(address indexed spender, Cosmos.Coin[] amount);

Parameters

NameTypeDescription
spenderaddressThe spender address
amountCosmos.Coin[]The amount of Cosmos coins spent

CoinReceived ‚Äč

Emitted by the bank module when amount tokens are received by receiver

solidity
event CoinReceived(address indexed receiver, Cosmos.Coin[] amount);
event CoinReceived(address indexed receiver, Cosmos.Coin[] amount);

Parameters

NameTypeDescription
receiveraddressThe receiver address
amountCosmos.Coin[]The amount of Cosmos coins received

Coinbase ‚Äč

"Coinbase" refers to the Cosmos event: EventTypeCoinMint

minter is always a module address

Emitted by the bank module when amount tokens are minted by minter

solidity
event Coinbase(address indexed minter, Cosmos.Coin[] amount);
event Coinbase(address indexed minter, Cosmos.Coin[] amount);

Parameters

NameTypeDescription
minteraddressThe minter address
amountCosmos.Coin[]The amount of Cosmos coins minted

Burn ‚Äč

burner is always a module address

Emitted by the bank module when amount tokens are burned by burner

solidity
event Burn(address indexed burner, Cosmos.Coin[] amount);
event Burn(address indexed burner, Cosmos.Coin[] amount);

Parameters

NameTypeDescription
burneraddressThe burner address
amountCosmos.Coin[]The amount of Cosmos coins burned

Structs ‚Äč

DenomUnit ‚Äč

this struct is generated in generated/i_bank_module.abigen.go

Represents a denom unit in the bank module

solidity
struct DenomUnit {
    string denom;
    string[] aliases;
    uint32 exponent;
}
struct DenomUnit {
    string denom;
    string[] aliases;
    uint32 exponent;
}

DenomMetadata ‚Äč

this struct is generated in generated/i_bank_module.abigen.go

Represents a denom metadata in the bank module

solidity
struct DenomMetadata {
    string description;
    DenomUnit[] denomUnits;
    string base;
    string display;
    string name;
    string symbol;
}
struct DenomMetadata {
    string description;
    DenomUnit[] denomUnits;
    string base;
    string display;
    string name;
    string symbol;
}