🌊
FluBid
  • Overview
  • Auction Types
    • Rental Auctions Overview
    • Continuous Rental Auction
    • English Rental Auction
  • Controllers
    • Controllers Overview
    • delegate.cash Controller
    • Lens Profile Controller
    • ERC4907 Controller
  • Contracts
    • Addresses
    • Contracts Documentation
  • GitHub
Powered by GitBook
On this page
  1. Controllers

delegate.cash Controller

PreviousControllers OverviewNextLens Profile Controller

Last updated 2 years ago

Rental Auction controller that sets the current renter as the sole delegate controlling the rented asset in the registry.

/// @title DelegateCashControllerObserver
/// @notice Rental auction controller delegates the ERC721 token to the renter using delegate.cash
contract DelegateCashControllerObserver is ERC721ControllerObserver {
    /// @notice The delegate.cash contract
    IDelegationRegistry public constant delegateCash = IDelegationRegistry(0x00000000000076A84feF008CDAbe6409d2FE638B);

    /// @notice Handle renter changed by delegating the ERC721 token to the new renter
    /// @param oldRenter The old renter
    /// @param newRenter The new renter
    function _onRenterChanged(address oldRenter, address newRenter) internal override {
        // Revoke the old renter
        if (oldRenter != address(0)) {
            delegateCash.delegateForAll(oldRenter, false);
        }

        // Delegate the new renter
        if (newRenter != address(0)) {
            delegateCash.delegateForAll(newRenter, true);
        }
    }
}
delegate.cash