Onchain.Aave.V4.TokenizationSpoke (onchain_aave v0.4.0)

Copy Markdown View Source

Aave V4 Tokenization Spoke reads — ERC-4626 share accounting plus V4 metadata.

Each Tokenization Spoke is a supply-only ERC-4626 vault for one {Hub, asset} pair. Resolve a configured spoke with lookup/3, then pass that address to the read functions. Amounts stay raw integers (token units / shares).

Error Format

Errors pass through from the underlying module that failed:

SourceError Shape
lookup/3{:error, {:unknown_hub, hub}}, {:error, {:unknown_tokenization_spoke, {hub, asset}}}, {:error, {:unsupported_network, network}}
Onchain.Address.validate/1{:error, {:invalid_address, input}}
Onchain.Contract.call/5{:error, {:encode_error, ...}}, {:error, {:rpc_error, ...}}, {:error, {:decode_error, ...}}

Functions

FunctionPurpose
lookup/3Resolve a configured spoke by {hub, asset}
asset/2Underlying ERC-20
total_assets/2Assets managed by the vault
total_supply/2Share token supply
balance_of/3Share balance of an owner
convert_to_shares/3Ideal assets → shares
convert_to_assets/3Ideal shares → assets
preview_deposit/3Shares minted for a deposit
preview_mint/3Assets required to mint shares
preview_withdraw/3Shares burned to withdraw assets
preview_redeem/3Assets returned when redeeming shares
max_deposit/3Deposit cap for a receiver
max_mint/3Mint cap for a receiver
max_withdraw/3Withdrawable assets for an owner
max_redeem/3Redeemable shares for an owner
hub/2Associated Hub
asset_id/2Hub asset identifier
max_allowed_spoke_cap/2Protocol spoke-cap bound
permit_nonce_namespace/2EIP-2612 permit nonce key
deposit_typehash/2Deposit intent typehash
mint_typehash/2Mint intent typehash
withdraw_typehash/2Withdraw intent typehash
redeem_typehash/2Redeem intent typehash
permit_typehash/2Share-token permit typehash
domain_separator/2EIP-712 domain separator

API Functions

FunctionArityDescriptionParam Kinds
domain_separator2EIP-712 domain separator for this Tokenization Spoke.spoke: value, opts: value
permit_typehash2EIP-712 typehash for the share-token permit.spoke: value, opts: value
redeem_typehash2EIP-712 typehash for the redeem intent.spoke: value, opts: value
withdraw_typehash2EIP-712 typehash for the withdraw intent.spoke: value, opts: value
mint_typehash2EIP-712 typehash for the mint intent.spoke: value, opts: value
deposit_typehash2EIP-712 typehash for the deposit intent.spoke: value, opts: value
permit_nonce_namespace2Nonce namespace used for share-token EIP-2612 permits.spoke: value, opts: value
max_allowed_spoke_cap2Maximum allowed spoke cap (ITokenizationSpoke constant).spoke: value, opts: value
asset_id2Hub asset identifier for this Tokenization Spoke.spoke: value, opts: value
hub2Hub this Tokenization Spoke is bound to.spoke: value, opts: value
max_redeem3Maximum shares an owner can redeem.spoke: value, owner: value, opts: value
max_withdraw3Maximum assets an owner can withdraw.spoke: value, owner: value, opts: value
max_mint3Maximum shares that can be minted for a receiver.spoke: value, receiver: value, opts: value
max_deposit3Maximum assets a receiver can deposit.spoke: value, receiver: value, opts: value
preview_redeem3Assets that would be returned when redeeming the given shares.spoke: value, shares: value, opts: value
preview_withdraw3Shares that would be burned to withdraw the given assets.spoke: value, assets: value, opts: value
preview_mint3Assets that would be deposited to mint the given shares.spoke: value, shares: value, opts: value
preview_deposit3Shares that would be minted for a deposit at the current block.spoke: value, assets: value, opts: value
convert_to_assets3Ideal asset amount exchanged for the given shares.spoke: value, shares: value, opts: value
convert_to_shares3Ideal share amount exchanged for the given assets.spoke: value, assets: value, opts: value
balance_of3Vault share balance of an owner.spoke: value, owner: value, opts: value
total_supply2Total supply of vault share tokens.spoke: value, opts: value
total_assets2Total underlying assets managed by the vault.spoke: value, opts: value
asset2Underlying ERC-20 of a Tokenization Spoke.spoke: value, opts: value
lookup3Resolve a configured V4 Tokenization Spoke by {hub, asset}.hub: value, asset: value, opts: value

Summary

Functions

Underlying ERC-20 of a Tokenization Spoke.

Hub asset identifier for this Tokenization Spoke.

Vault share balance of an owner.

Ideal asset amount exchanged for the given shares.

Ideal share amount exchanged for the given assets.

EIP-712 typehash for the deposit intent.

EIP-712 domain separator for this Tokenization Spoke.

Hub this Tokenization Spoke is bound to.

Resolve a configured V4 Tokenization Spoke by {hub, asset}.

Maximum allowed spoke cap (ITokenizationSpoke constant).

Maximum assets a receiver can deposit.

Maximum shares that can be minted for a receiver.

Maximum shares an owner can redeem.

Maximum assets an owner can withdraw.

EIP-712 typehash for the mint intent.

Nonce namespace used for share-token EIP-2612 permits.

EIP-712 typehash for the share-token permit.

Shares that would be minted for a deposit at the current block.

Assets that would be deposited to mint the given shares.

Assets that would be returned when redeeming the given shares.

Shares that would be burned to withdraw the given assets.

EIP-712 typehash for the redeem intent.

Total underlying assets managed by the vault.

Total supply of vault share tokens.

EIP-712 typehash for the withdraw intent.

Types

hub()

@type hub() :: :core | :prime | :plus

Functions

asset(spoke, opts \\ [])

@spec asset(
  String.t() | binary(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

Underlying ERC-20 of a Tokenization Spoke.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Checksummed underlying address ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "Checksummed underlying address"
  }
}

asset_id(spoke, opts \\ [])

@spec asset_id(
  String.t() | binary(),
  keyword()
) :: {:ok, non_neg_integer()} | {:error, term()}

Hub asset identifier for this Tokenization Spoke.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Asset identifier ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Asset identifier"
  }
}

balance_of(spoke, owner, opts \\ [])

@spec balance_of(String.t() | binary(), String.t() | binary(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Vault share balance of an owner.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • owner - Account address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Share balance ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    owner: %{
      description: "Account address as 0x hex string or 20-byte binary",
      kind: :value
    },
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Share balance"
  }
}

convert_to_assets(spoke, shares, opts \\ [])

@spec convert_to_assets(String.t() | binary(), non_neg_integer(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Ideal asset amount exchanged for the given shares.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • shares - Share token amount (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Assets (token units) ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    },
    shares: %{description: "Share token amount", kind: :value}
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Assets (token units)"
  }
}

convert_to_shares(spoke, assets, opts \\ [])

@spec convert_to_shares(String.t() | binary(), non_neg_integer(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Ideal share amount exchanged for the given assets.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • assets - Asset amount in token units (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Shares ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    assets: %{description: "Asset amount in token units", kind: :value},
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Shares"
  }
}

deposit_typehash(spoke, opts \\ [])

@spec deposit_typehash(
  String.t() | binary(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

EIP-712 typehash for the deposit intent.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

0x-prefixed bytes32 ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "0x-prefixed bytes32"
  }
}

domain_separator(spoke, opts \\ [])

@spec domain_separator(
  String.t() | binary(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

EIP-712 domain separator for this Tokenization Spoke.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

0x-prefixed bytes32 ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "0x-prefixed bytes32"
  }
}

hub(spoke, opts \\ [])

@spec hub(
  String.t() | binary(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

Hub this Tokenization Spoke is bound to.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Checksummed Hub address ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "Checksummed Hub address"
  }
}

lookup(hub, asset, opts \\ [])

@spec lookup(hub(), atom(), keyword()) :: {:ok, String.t()} | {:error, term()}

Resolve a configured V4 Tokenization Spoke by {hub, asset}.

Parameters

  • hub - Hub atom: :core, :prime, or :plus (value)
  • asset - Underlying asset atom, e.g. :weth, :usdc, :pt_susde (value)
  • opts - Options: [network: :ethereum] (default: [], value)

Returns

Checksummed Tokenization Spoke address ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: [network: :ethereum]",
      kind: :value
    },
    asset: %{
      description: "Underlying asset atom, e.g. :weth, :usdc, :pt_susde",
      kind: :value
    },
    hub: %{description: "Hub atom: :core, :prime, or :plus", kind: :value}
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "Checksummed Tokenization Spoke address",
    example: "0x7320CF22Ac095bA2a2e0a652F77efB836c2E751b"
  }
}

max_allowed_spoke_cap(spoke, opts \\ [])

@spec max_allowed_spoke_cap(
  String.t() | binary(),
  keyword()
) :: {:ok, non_neg_integer()} | {:error, term()}

Maximum allowed spoke cap (ITokenizationSpoke constant).

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Cap bound (uint40) ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Cap bound (uint40)"
  }
}

max_deposit(spoke, receiver, opts \\ [])

@spec max_deposit(String.t() | binary(), String.t() | binary(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Maximum assets a receiver can deposit.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • receiver - Account address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Max deposit (token units) ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    receiver: %{
      description: "Account address as 0x hex string or 20-byte binary",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Max deposit (token units)"
  }
}

max_mint(spoke, receiver, opts \\ [])

@spec max_mint(String.t() | binary(), String.t() | binary(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Maximum shares that can be minted for a receiver.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • receiver - Account address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Max shares minted ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    receiver: %{
      description: "Account address as 0x hex string or 20-byte binary",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Max shares minted"
  }
}

max_redeem(spoke, owner, opts \\ [])

@spec max_redeem(String.t() | binary(), String.t() | binary(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Maximum shares an owner can redeem.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • owner - Account address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Max shares redeemed ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    owner: %{
      description: "Account address as 0x hex string or 20-byte binary",
      kind: :value
    },
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Max shares redeemed"
  }
}

max_withdraw(spoke, owner, opts \\ [])

@spec max_withdraw(String.t() | binary(), String.t() | binary(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Maximum assets an owner can withdraw.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • owner - Account address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Max withdraw (token units) ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    owner: %{
      description: "Account address as 0x hex string or 20-byte binary",
      kind: :value
    },
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Max withdraw (token units)"
  }
}

mint_typehash(spoke, opts \\ [])

@spec mint_typehash(
  String.t() | binary(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

EIP-712 typehash for the mint intent.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

0x-prefixed bytes32 ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "0x-prefixed bytes32"
  }
}

permit_nonce_namespace(spoke, opts \\ [])

@spec permit_nonce_namespace(
  String.t() | binary(),
  keyword()
) :: {:ok, non_neg_integer()} | {:error, term()}

Nonce namespace used for share-token EIP-2612 permits.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Permit nonce key (uint192) ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Permit nonce key (uint192)"
  }
}

permit_typehash(spoke, opts \\ [])

@spec permit_typehash(
  String.t() | binary(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

EIP-712 typehash for the share-token permit.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

0x-prefixed bytes32 ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "0x-prefixed bytes32"
  }
}

preview_deposit(spoke, assets, opts \\ [])

@spec preview_deposit(String.t() | binary(), non_neg_integer(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Shares that would be minted for a deposit at the current block.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • assets - Asset amount in token units (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Shares minted ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    assets: %{description: "Asset amount in token units", kind: :value},
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Shares minted"
  }
}

preview_mint(spoke, shares, opts \\ [])

@spec preview_mint(String.t() | binary(), non_neg_integer(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Assets that would be deposited to mint the given shares.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • shares - Share token amount (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Assets deposited ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    },
    shares: %{description: "Share token amount", kind: :value}
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Assets deposited"
  }
}

preview_redeem(spoke, shares, opts \\ [])

@spec preview_redeem(String.t() | binary(), non_neg_integer(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Assets that would be returned when redeeming the given shares.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • shares - Share token amount (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Assets returned ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    },
    shares: %{description: "Share token amount", kind: :value}
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Assets returned"
  }
}

preview_withdraw(spoke, assets, opts \\ [])

@spec preview_withdraw(String.t() | binary(), non_neg_integer(), keyword()) ::
  {:ok, non_neg_integer()} | {:error, term()}

Shares that would be burned to withdraw the given assets.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • assets - Asset amount in token units (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Shares burned ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    assets: %{description: "Asset amount in token units", kind: :value},
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Shares burned"
  }
}

redeem_typehash(spoke, opts \\ [])

@spec redeem_typehash(
  String.t() | binary(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

EIP-712 typehash for the redeem intent.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

0x-prefixed bytes32 ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "0x-prefixed bytes32"
  }
}

total_assets(spoke, opts \\ [])

@spec total_assets(
  String.t() | binary(),
  keyword()
) :: {:ok, non_neg_integer()} | {:error, term()}

Total underlying assets managed by the vault.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Managed assets (token units) ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Managed assets (token units)"
  }
}

total_supply(spoke, opts \\ [])

@spec total_supply(
  String.t() | binary(),
  keyword()
) :: {:ok, non_neg_integer()} | {:error, term()}

Total supply of vault share tokens.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

Share token supply ({:ok, non_neg_integer()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, non_neg_integer()} | {:error, term()}",
    description: "Share token supply"
  }
}

withdraw_typehash(spoke, opts \\ [])

@spec withdraw_typehash(
  String.t() | binary(),
  keyword()
) :: {:ok, String.t()} | {:error, term()}

EIP-712 typehash for the withdraw intent.

Parameters

  • spoke - Tokenization Spoke address as 0x hex string or 20-byte binary (value)
  • opts - Options: :network (default :ethereum), :rpc_url, :timeout, :block (default: [], value)

Returns

0x-prefixed bytes32 ({:ok, String.t()} | {:error, term()})

# descripex:contract
%{
  params: %{
    opts: %{
      default: [],
      description: "Options: :network (default :ethereum), :rpc_url, :timeout, :block",
      kind: :value
    },
    spoke: %{
      description: "Tokenization Spoke address as 0x hex string or 20-byte binary",
      kind: :value
    }
  },
  returns: %{
    type: "{:ok, String.t()} | {:error, term()}",
    description: "0x-prefixed bytes32"
  }
}