Consensys / linea-attestation-registry

Verax is a shared registry for storing attestations of public interest on EVM chains, designed to enhance data discoverability and consumption for dApps across the network.
https://ver.ax
MIT License
142 stars 71 forks source link

[TASK] Implement a default `withdraw` function #790

Closed alainncls closed 1 week ago

alainncls commented 3 weeks ago

Currently, the withdraw function of a Portal is not implemented at all by default, which can lead to funds being stuck on it.

That's why we'll implement a default withdraw function, at the AbstractPortal level, to make sure there is always a way to retrieve the funds.

Proposed implementation:

    /**
     * @notice Withdraw funds from the Portal
     * @param to the address to send the funds to
     * @param amount the amount to withdraw
     * @dev Only the Portal owner can withdraw funds
     */
    function withdraw(address payable to, uint256 amount) external override onlyPortalOwner {
        (bool s, ) = to.call{value: amount}("");
        if (!s) revert WithdrawFail();
    }