Skip to content

Latest commit

 

History

History
229 lines (207 loc) · 7.4 KB

BaseLibV1.md

File metadata and controls

229 lines (207 loc) · 7.4 KB

BaseLibV1.sol

View Source: contracts/libraries/BaseLibV1.sol

BaseLibV1

Functions

recoverEtherInternal

Recover all Ether held by the contract. On success, no event is emitted because the recovery feature does not have any significance in the SDK or the UI.

function recoverEtherInternal(address sendTo) external nonpayable

Arguments

Name Type Description
sendTo address
Source Code
function recoverEtherInternal(address sendTo) external {
    // slither-disable-next-line low-level-calls
    (bool success, ) = payable(sendTo).call{value: address(this).balance}(""); // solhint-disable-line avoid-low-level-calls
    require(success, "Recipient may have reverted");
  }

recoverTokenInternal

Recover all IERC-20 compatible tokens sent to this address. On success, no event is emitted because the recovery feature does not have any significance in the SDK or the UI.

function recoverTokenInternal(address token, address sendTo) external nonpayable

Arguments

Name Type Description
token address IERC-20 The address of the token contract
sendTo address
Source Code
function recoverTokenInternal(address token, address sendTo) external {
    IERC20 erc20 = IERC20(token);

    uint256 balance = erc20.balanceOf(address(this));

    if (balance > 0) {
      // slither-disable-next-line unchecked-transfer
      erc20.safeTransfer(sendTo, balance);
    }
  }

Contracts