Skip to main content
logo

address-provider

Holds addresses of the main contracts of the core protocol.

InstantiateMsg

Instantiates the Address Provider contract.

Essentially, mars_address_provider is a required init param for all other contracts, so it needs to be initialised first (Only owner can be set on initialization). So the deployment looks like this:

  1. Init the address provider
  2. Init all other contracts, passing in the address provider address (not ALL contracts need this but many do)
  3. Update the address provider, with an update config call to contain all the other contract addresses from step 2, this is why we need it to be owned by an EOA (externally owned account) - so we can do this update as part of the deployment
  4. Update the owner of the address provider contract at the end of deployment to be either a. the multisig or b. the gov/council contract
json
address_provider.rs
Copy

_4
{
_4
"owner": "...",
_4
"prefix": "..."
_4
}

ParamsTypeDescription
ownerStringContract owner
prefixStringThe address prefix of the chain this contract is deployed on

ExecuteMsg

set_address

Set address.

json
address_provider.rs
Copy

_8
{
_8
"set_address": {
_8
"address_type": {
_8
"incentives": {}
_8
},
_8
"address": "..."
_8
}
_8
}

ParamsTypeDescription
address_typeMarsAddressTypeMars address type
addressString

MarsAddressType

address_provider.rs
Copy

_11
#[cw_serde]
_11
#[derive(Copy, Eq, Hash)]
_11
pub enum MarsAddressType {
_11
Incentives,
_11
Oracle,
_11
RedBank,
_11
RewardsCollector,
_11
ProtocolAdmin,
_11
FeeCollector,
_11
SafetyFund,
_11
}

NOTE

protocol_admin fee_collector and safety_fund are Mars Hub addresses with mars bech32 prefixes, which may not be recognizeded by the api.addr_validate method.

VariantsDescription
IncentivesIncentives contract address
OracleOracles contract address
RedBankRed Bank contract address
RewardsCollectorRewards collector contract address
ProtocolAdminProtocol admin is an ICS-27 interchain account controlled by Mars Hub's x/gov module. This account will take the owner and admin roles of outpost contracts.
FeeCollectorThe fee_collector module account controlled by Mars Hub's x/distribution module. Funds sent to this account will be distributed as staking rewards.
SafetyFundThe module account controlled by the by Mars Hub's x/safety module. Funds sent to this account will be deposited into the safety fund.

update_owner

Manages admin role state.

json
address_provider.rs
Copy

_7
{
_7
"update_owner": {
_7
"propose_new_owner": {
_7
"proposed": "..."
_7
}
_7
}
_7
}

QueryMsg

config

Queries contract config.

json
address_provider.rs
Copy

_3
{
_3
"config": {}
_3
}

Config (response)

json
address_provider.rs
Copy

_4
{
_4
"owner": "...",
_4
"prefix": "..."
_4
}

ParamsTypeDescription
ownerStringContract owner
prefixStringThe address prefix of the chain this contract is deployed on

address

Queries a single address.

json
address_provider.rs
Copy

_3
{
_3
"address": "incentives"
_3
}

ParamsTypeDescription
addressMarsAddressTypeAddress to return

AddressResponseItem

json
address_provider.rs
Copy

_4
{
_4
"address_type": "incentive",
_4
"address": "..."
_4
}

ParamsTypeDescription
address_typeMarsAddressTypeThe type of address
addressStringAddress value

addresses

Queries a list of addresses.

json
address_provider.rs
Copy

_7
{
_7
"addresses": [
_7
"incentives",
_7
"red_bank",
_7
"oracle"
_7
]
_7
}

ParamsTypeDescription
addressesVec<MarsAddressType>Addresses to return

Returns a vector that contains objects of type AddressResponseItem.

all_addresses

Query all stored addresses with pagination.

json
address_provider.rs
Copy

_6
{
_6
"all_addresses": {
_6
"start_after": "incentives",
_6
"limit": 5
_6
}
_6
}

ParamsTypeDescription
start_afterOption<MarsAddressType>Address to start list with
limitOption<u32>Amount of addresses to list

Returns a vector that contains objects of type AddressResponseItem.