PoolAddressesProvider

Main registry of addresses part of or connected to the protocol, including permissioned roles

Acts as factory of proxies and admin of those, so with right to change its implementations Owned by the ParaSpace Governance

_marketId

string _marketId

_addresses

mapping(bytes32 => address) _addresses

_marketplaces

mapping(bytes32 => struct DataTypes.Marketplace) _marketplaces

POOL

bytes32 POOL

POOL_CONFIGURATOR

bytes32 POOL_CONFIGURATOR

PRICE_ORACLE

bytes32 PRICE_ORACLE

ACL_MANAGER

bytes32 ACL_MANAGER

ACL_ADMIN

bytes32 ACL_ADMIN

PRICE_ORACLE_SENTINEL

bytes32 PRICE_ORACLE_SENTINEL

DATA_PROVIDER

bytes32 DATA_PROVIDER

WETH

bytes32 WETH

constructor

constructor(string marketId, address owner) public

Constructor.

Parameters

Name
Type
Description

marketId

string

The identifier of the market.

owner

address

The owner address of this contract.

getMarketId

function getMarketId() external view returns (string)

Returns the id of the ParaSpace market to which this contract points to.

Return Values

Name
Type
Description

[0]

string

The market id

setMarketId

function setMarketId(string newMarketId) external

Associates an id with a specific PoolAddressesProvider.

This can be used to create an onchain registry of PoolAddressesProviders to identify and validate multiple ParaSpace markets.

Parameters

Name
Type
Description

newMarketId

string

The market id

getAddress

function getAddress(bytes32 id) public view returns (address)

Returns an address by its identifier.

The returned address might be an EOA or a contract, potentially proxied It returns ZERO if there is no registered address with the given id

Parameters

Name
Type
Description

id

bytes32

The id

Return Values

Name
Type
Description

[0]

address

The address of the registered for the specified id

setAddress

function setAddress(bytes32 id, address newAddress) external

Sets an address for an id replacing the address saved in the addresses map.

IMPORTANT Use this function carefully, as it will do a hard replacement

Parameters

Name
Type
Description

id

bytes32

The id

newAddress

address

The address to set

setAddressAsProxy

function setAddressAsProxy(bytes32 id, address newImplementationAddress) external

General function to update the implementation of a proxy registered with certain id. If there is no proxy registered, it will instantiate one and set as implementation the newImplementationAddress.

IMPORTANT Use this function carefully, only for ids that don't have an explicit setter function, in order to avoid unexpected consequences

Parameters

Name
Type
Description

id

bytes32

The id

newImplementationAddress

address

The address of the new implementation

getPool

function getPool() external view returns (address)

Returns the address of the Pool proxy.

Return Values

Name
Type
Description

[0]

address

The Pool proxy address

updatePoolImpl

function updatePoolImpl(struct IParaProxy.ProxyImplementation[] implementationParams, address _init, bytes _calldata) external

Updates the implementation of the Pool, or creates a proxy setting the new pool implementation when the function is called for the first time.

Parameters

Name
Type
Description

implementationParams

struct IParaProxy.ProxyImplementation[]

Contains the implementation addresses and function selectors

_init

address

The address of the contract or implementation to execute _calldata

_calldata

bytes

A function call, including function selector and arguments _calldata is executed with delegatecall on _init

getPoolConfigurator

function getPoolConfigurator() external view returns (address)

Returns the address of the PoolConfigurator proxy.

Return Values

Name
Type
Description

[0]

address

The PoolConfigurator proxy address

setPoolConfiguratorImpl

function setPoolConfiguratorImpl(address newPoolConfiguratorImpl) external

Updates the implementation of the PoolConfigurator, or creates a proxy setting the new PoolConfigurator implementation when the function is called for the first time.

Parameters

Name
Type
Description

newPoolConfiguratorImpl

address

The new PoolConfigurator implementation

getPriceOracle

function getPriceOracle() external view returns (address)

Returns the address of the price oracle.

Return Values

Name
Type
Description

[0]

address

The address of the PriceOracle

setPriceOracle

function setPriceOracle(address newPriceOracle) external

Updates the address of the price oracle.

Parameters

Name
Type
Description

newPriceOracle

address

The address of the new PriceOracle

getACLManager

function getACLManager() external view returns (address)

Returns the address of the ACL manager.

Return Values

Name
Type
Description

[0]

address

The address of the ACLManager

setACLManager

function setACLManager(address newAclManager) external

Updates the address of the ACL manager.

Parameters

Name
Type
Description

newAclManager

address

The address of the new ACLManager

getACLAdmin

function getACLAdmin() external view returns (address)

Returns the address of the ACL admin.

Return Values

Name
Type
Description

[0]

address

The address of the ACL admin

setACLAdmin

function setACLAdmin(address newAclAdmin) external

Updates the address of the ACL admin.

Parameters

Name
Type
Description

newAclAdmin

address

The address of the new ACL admin

getPriceOracleSentinel

function getPriceOracleSentinel() external view returns (address)

Returns the address of the price oracle sentinel.

Return Values

Name
Type
Description

[0]

address

The address of the PriceOracleSentinel

setPriceOracleSentinel

function setPriceOracleSentinel(address newPriceOracleSentinel) external

Updates the address of the price oracle sentinel.

Parameters

Name
Type
Description

newPriceOracleSentinel

address

The address of the new PriceOracleSentinel

getPoolDataProvider

function getPoolDataProvider() external view returns (address)

Returns the address of the data provider.

Return Values

Name
Type
Description

[0]

address

The address of the DataProvider

getWETH

function getWETH() external view returns (address)

Returns the address of the Wrapped ETH.

Return Values

Name
Type
Description

[0]

address

The address of the Wrapped ETH

getMarketplace

function getMarketplace(bytes32 id) external view returns (struct DataTypes.Marketplace)

Returns the info of the marketplace.

Return Values

Name
Type
Description

[0]

struct DataTypes.Marketplace

The info of the marketplace

setProtocolDataProvider

function setProtocolDataProvider(address newDataProvider) external

Updates the address of the data provider.

Parameters

Name
Type
Description

newDataProvider

address

The address of the new DataProvider

setWETH

function setWETH(address newWETH) external

Updates the address of the WETH.

Parameters

Name
Type
Description

newWETH

address

The address of the new WETH

setMarketplace

function setMarketplace(bytes32 id, address marketplace, address adapter, address operator, bool paused) external

Updates the info of the marketplace.

Parameters

Name
Type
Description

id

bytes32

marketplace

address

The address of the marketplace @param adapter The contract which handles marketplace logic

adapter

address

operator

address

The contract which operates users' tokens

paused

bool

_updateImpl

function _updateImpl(bytes32 id, address newAddress) internal

Internal function to update the implementation of a specific proxied component of the protocol.

If there is no proxy registered with the given identifier, it creates the proxy setting newAddress as implementation and calls the initialize() function on the proxy If there is already a proxy registered, it just updates the implementation to newAddress and calls the initialize() function via upgradeToAndCall() in the proxy

Parameters

Name
Type
Description

id

bytes32

The id of the proxy to be updated

newAddress

address

The address of the new implementation

_updateParaProxyImpl

function _updateParaProxyImpl(bytes32 id, struct IParaProxy.ProxyImplementation[] implementationParams, address _init, bytes _calldata) internal

Internal function to update the implementation of a specific proxied component of the protocol that uses ParaProxy.

_If there is no proxy registered with the given identifier, it creates the proxy setting newAddress as implementation and calls the calldata on the init If there is already a proxy registered, it just updates the implementation using the implementationParams

Parameters

Name
Type
Description

id

bytes32

The id of the proxy to be updated

implementationParams

struct IParaProxy.ProxyImplementation[]

Contains the implementation addresses and function selectors

_init

address

The address of the contract or implementation to execute _calldata

_calldata

bytes

A function call, including function selector and arguments _calldata is executed with delegatecall on _init

_setMarketId

function _setMarketId(string newMarketId) internal

Updates the identifier of the ParaSpace market.

Parameters

Name
Type
Description

newMarketId

string

The new id of the market

_getProxyImplementation

function _getProxyImplementation(bytes32 id) internal returns (address)

Returns the the implementation contract of the proxy contract by its identifier.

It returns ZERO if there is no registered address with the given id It reverts if the registered address with the given id is not InitializableImmutableAdminUpgradeabilityProxy

Parameters

Name
Type
Description

id

bytes32

The id

Return Values

Name
Type
Description

[0]

address

The address of the implementation contract