Skip to content
Lattice

ISafeHarborAdopter

Git Source

Title: ISafeHarborAdopter

Authors: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80), Integrates the SEAL Whitehat Safe Harbor (https://github.com/security-alliance/safe-harbor)

External interface for the Safe Harbor adopter facet: lets a diamond adopt the SEAL Whitehat Safe Harbor agreement on-chain (the legal half of incident response, complementing the EmergencyStop technical half).

Adoption in the SEAL SafeHarborRegistry is keyed by msg.sender, so the diamond adopts itself — the same self-call pattern Lattice uses for diamondCut. Because the agreement's asset-recovery addresses and bounty terms are security-critical, all state-changing functions are gated on SAFE_HARBOR_ADMIN_ROLE. The registry + factory addresses are configurable per chain (never hardcoded).

Functions

adoptSafeHarbor

Adopts a pre-deployed agreement for this diamond via the configured registry.

Gated on SAFE_HARBOR_ADMIN_ROLE. The diamond calls the registry itself, so it is recorded as the adopter. Re-adopting overwrites the prior agreement (the update path).

function adoptSafeHarbor(address agreement) external;

Parameters

NameTypeDescription
agreementaddressThe agreement contract to adopt.

createAndAdopt

Creates an agreement (recovery addresses + bounty terms) via the configured factory and adopts it for this diamond, in one governed call.

Gated on SAFE_HARBOR_ADMIN_ROLE. This is where the security-critical recovery addresses are set, so the whole action is role-pinned.

function createAndAdopt(AgreementDetails calldata details, address chainValidator, address owner, bytes32 salt)
        external
        returns (address agreement);

Parameters

NameTypeDescription
detailsAgreementDetailsThe agreement details (per-chain recovery address, accounts, bounty terms).
chainValidatoraddressThe SEAL ChainValidator contract for this chain.
owneraddressThe owner of the new agreement (may later update its terms).
saltbytes32A caller-provided salt for CREATE2 uniqueness.

Returns

NameTypeDescription
agreementaddressThe newly created and adopted agreement address.

setSafeHarborRegistry

Sets or rotates the Safe Harbor registry (per-chain configuration).

Gated on SAFE_HARBOR_ADMIN_ROLE. Reverts SafeHarborAdopterZeroRegistry for a zero address.

function setSafeHarborRegistry(address registry) external;

Parameters

NameTypeDescription
registryaddressThe Safe Harbor registry to use.

setAgreementFactory

Sets or rotates the agreement factory (per-chain configuration).

Gated on SAFE_HARBOR_ADMIN_ROLE. Reverts SafeHarborAdopterZeroFactory for a zero address.

function setAgreementFactory(address factory) external;

Parameters

NameTypeDescription
factoryaddressThe agreement factory to use.

safeHarborRegistry

Returns the configured Safe Harbor registry.

function safeHarborRegistry() external view returns (address);

Returns

NameTypeDescription
<none>address

agreementFactory

Returns the configured agreement factory.

function agreementFactory() external view returns (address);

Returns

NameTypeDescription
<none>address

safeHarborAgreement

Returns the agreement currently adopted by this diamond (zero if none).

function safeHarborAgreement() external view returns (address);

Returns

NameTypeDescription
<none>address

Events

SafeHarborAdopted

Emitted when the diamond adopts (or re-adopts) a Safe Harbor agreement.

event SafeHarborAdopted(address indexed agreement);

Parameters

NameTypeDescription
agreementaddressThe adopted agreement contract.

SafeHarborRegistrySet

Emitted when the configured Safe Harbor registry is set or rotated.

event SafeHarborRegistrySet(address indexed registry);

Parameters

NameTypeDescription
registryaddress

AgreementFactorySet

Emitted when the configured agreement factory is set or rotated.

event AgreementFactorySet(address indexed factory);

Parameters

NameTypeDescription
factoryaddress

Errors

SafeHarborAdopterZeroRegistry

Thrown when a zero address is supplied as the Safe Harbor registry.

error SafeHarborAdopterZeroRegistry();

SafeHarborAdopterZeroFactory

Thrown when createAndAdopt is called with no agreement factory configured, or a zero factory is supplied to setAgreementFactory.

error SafeHarborAdopterZeroFactory();

SafeHarborAdopterZeroAgreement

Thrown when a zero agreement address is supplied to adoptSafeHarbor.

error SafeHarborAdopterZeroAgreement();