GuardianAdapter

Description:

Smart contract deployed on Ethereum.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

// SPDX-License-Identifier: MIT
pragma solidity 0.8.20;

/// @notice Minimal read-through interface for your existing Guardian
interface ICosigoGuardian {
    // Per-satellite policy
    function isSatelliteApproved(address sat) external view returns (bool);
    function feeSinkOf(address sat) external view returns (address);
    function guardianFeeBpsOf(address sat) external view returns (uint16);

    // Global signals
    function isMarketOpen() external view returns (bool);
    function eoaOnlyEnabled() external view returns (bool);

    // Global caps
    function maxGuardianFeeBps() external view returns (uint16);
    function maxMaintenanceFeeBps() external view returns (uint16);
    function maxRedemptionFeeBps() external view returns (uint16);
    function maxPremiumBps() external view returns (uint16);

    // Registry helper
    function satelliteBySlug(bytes32 slugHash) external view returns (address);
}

/// @notice The Satellite only needs someone to call acceptGuardian().
interface ISatellite {
    function acceptGuardian() external;
    function guardian() external view returns (address); // optional readback
}

/// @notice Minimal adapter that:
///  - forwards all READS to the real Guardian (so policy stays centralized)
///  - exposes a ONE-TIME helper to call sat.acceptGuardian() as msg.sender = this adapter
contract GuardianAdapter {
    ICosigoGuardian public immutable real;

    constructor(address realGuardian) {
        require(realGuardian != address(0), "guardian=0");
        real = ICosigoGuardian(realGuardian);
    }

    // ---------- one-time helper ----------
    function acceptOnSatellite(address satellite) external {
        require(satellite != address(0), "sat=0");
        ISatellite(satellite).acceptGuardian();
    }

    // ---------- read-throughs ----------
    function isSatelliteApproved(address sat) external view returns (bool) { return real.isSatelliteApproved(sat); }
    function feeSinkOf(address sat) external view returns (address)       { return real.feeSinkOf(sat); }
    function guardianFeeBpsOf(address sat) external view returns (uint16) { return real.guardianFeeBpsOf(sat); }

    function isMarketOpen() external view returns (bool)                  { return real.isMarketOpen(); }
    function eoaOnlyEnabled() external view returns (bool)                { return real.eoaOnlyEnabled(); }

    function maxGuardianFeeBps() external view returns (uint16)           { return real.maxGuardianFeeBps(); }
    function maxMaintenanceFeeBps() external view returns (uint16)        { return real.maxMaintenanceFeeBps(); }
    function maxRedemptionFeeBps() external view returns (uint16)         { return real.maxRedemptionFeeBps(); }
    function maxPremiumBps() external view returns (uint16)               { return real.maxPremiumBps(); }

    function satelliteBySlug(bytes32 h) external view returns (address)   { return real.satelliteBySlug(h); }
}

Tags:
addr:0xbeab0d63f0a49a3c468159c0e7a75971e4d19883|verified:true|block:23592946|tx:0xf4c28d7efeca1b1bd025ee0049ac211c94a21bd79730f01b3e658b364f4b14d1|first_check:1760686484

Submitted on: 2025-10-17 09:34:44

Comments

Log in to comment.

No comments yet.