DiodeClient.Contracts.Factory (Diode Client v1.4.12)

View Source

This module is used to create and manage the factory contract. The factory is creating Proxy contracts for deployed implementations. Only the original transaction submitter can upgrade the implementation.

Summary

Functions

address(shell)

contract_type(shell, address, block \\ nil)

Detects the contract family behind address.

Order:

  1. Match EIP-1967 implementation (or the address itself) against known factory Drive / DriveMember targets — works for Moonbeam DriveMember v114 which has no Type() yet, and avoids a reverting Type() eth_call.
  2. On-chain Type() ("Drive", "DriveMember", …).
  3. Version heuristic: Drive ≥ 150, DriveMember otherwise when Version() works.

contracts(arg)

create_identity_meta_tx(shell)

create_identity_request(shell)

create_identity_tx(shell)

This initial identity creation is tricky on different chains because of the gas management. We cover three cases:

  • Diode L1: Gasless chain, anyone can submit their own transactions
  • Moonbeam: Third parties can pay the gas for others using the native "Call Permit" PreCompile
  • Sapphire: Normal gas payment is needed, after identity creation, we can use MetaTransactions against the identity

drive_member_target(shell)

fleet_member_target(shell)

get_anvil_contracts()

identity_address(shell, wallet \\ DiodeClient.wallet())

identity_address_call(shell, wallet \\ DiodeClient.wallet())

identity_salt(shell, wallet \\ DiodeClient.wallet())

is_factory(address)

proxy_code(shell, factory_address)

proxy_code_hash(shell)

self_check()

set_anvil_contracts(list)

shells()

upgrade_identity_tx(shell)