Functions

nativeDomesticAsset

  function nativeDomesticAsset(
  ) public returns (struct AssetRegistry.AssetDefinition assetDefinition)

Return the CAP-native asset definition.


lookup

  function lookup(
    struct AssetRegistry.AssetDefinition assetDefinition
  ) public returns (address)

Fetch the ERC-20 token address corresponding to the given asset definition.

Parameters

NameTypeDescription
assetDefinitionstruct AssetRegistry.AssetDefinitionan asset definition

Return Values

ReturnsTypeDescription
struct AssetRegistry.AssetDefinitionERC-20 address

isCapeAssetRegistered

  function isCapeAssetRegistered(
    struct AssetRegistry.AssetDefinition assetDefinition
  ) public returns (bool)

Is the given asset definition registered?

Parameters

NameTypeDescription
assetDefinitionstruct AssetRegistry.AssetDefinitionan asset definition

Return Values

ReturnsTypeDescription
struct AssetRegistry.AssetDefinitionif the asset type is registered, false otherwise.

sponsorCapeAsset

  function sponsorCapeAsset(
    address erc20Address,
    struct AssetRegistry.AssetDefinition newAsset
  ) external

Create and register a new asset type associated with an ERC-20 token. Will revert if the asset type is already registered or the ERC-20 token address is zero.

Parameters

NameTypeDescription
erc20AddressaddressAn ERC-20 token address
newAssetstruct AssetRegistry.AssetDefinitionAn asset type to be registered in the contract

_checkForeignAssetCode

  function _checkForeignAssetCode(
    uint256 assetDefinitionCode,
    address erc20Address,
    address sponsor,
    struct AssetRegistry.AssetPolicy policy
  ) internal

Throws an exception if the asset definition code is not correctly derived from the ERC-20 address of the token and the address of the sponsor.

Requires "view" to access msg.sender.

Parameters

NameTypeDescription
assetDefinitionCodeuint256The code of an asset definition
erc20AddressaddressThe ERC-20 address bound to the asset definition
sponsoraddressThe sponsor address of this wrapped asset
policystruct AssetRegistry.AssetPolicyasset policy

_checkDomesticAssetCode

  function _checkDomesticAssetCode(
    uint256 assetDefinitionCode,
    uint256 internalAssetCode
  ) internal

Checks if the asset definition code is correctly derived from the internal asset code.

Parameters

NameTypeDescription
assetDefinitionCodeuint256asset definition code
internalAssetCodeuint256internal asset code

_computeAssetDescription

  function _computeAssetDescription(
    address erc20Address,
    address sponsor,
    struct AssetRegistry.AssetPolicy policy
  ) internal returns (bytes)

Compute the asset description from the address of the ERC-20 token and the address of the sponsor.

Parameters

NameTypeDescription
erc20Addressaddressaddress of the erc20 token
sponsoraddressaddress of the sponsor
policystruct AssetRegistry.AssetPolicyasset policy

Return Values

ReturnsTypeDescription
addressasset description

Events

AssetSponsored

  event AssetSponsored(
  )