Skip to main content

CashManager.sol

Read code on GitHub

Utils contract to manage ETH and token balances

Methods

WETH9

Returns the address of WETH9

Solidity
function WETH9() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

factory

Returns the address of the factory

Solidity
function factory() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

positionDescriptor

Returns the address of the PositionDescriptor

Solidity
function positionDescriptor() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

refundETH

Transfers the ETH balance of the contract to the caller

Solidity
function refundETH() external payable

sweepToken

Transfers the tokens in the contract to a recipient

Solidity
function sweepToken(address token, uint256 amountMin, address recipient) external payable

Parameters

NameTypeDescription
tokenaddressAddress of the token to sweep
amountMinuint256Minimum amount to transfer
recipientaddressRecipient of the tokens

unwrap

Unwraps WETH to ETH and transfers to a recipient

Solidity
function unwrap(uint256 amountMin, address recipient) external payable

Parameters

NameTypeDescription
amountMinuint256Minimum amount to unwrap
recipientaddressAddress of the recipient

wrap

Wraps ETH into WETH and transfers to the msg.sender

Solidity
function wrap(uint256 value) external payable

Parameters

NameTypeDescription
valueuint256Amount of ETH to wrap

Errors

BalanceTooLowError

Thrown when the amount required is above balance

Solidity
error BalanceTooLowError(uint256 balance, uint256 requiredAmount)

Parameters

NameTypeDescription
balanceuint256Actual ETH or token balance of the contract
requiredAmountuint256ETH or token amount required by the user

LockedError

Thrown when a call to the contract is made during a locked state

Solidity
error LockedError()

NotEngineError

Thrown when the sender is not a Primitive Engine contract

Solidity
error NotEngineError()

OnlyWETHError

Thrown when the sender is not WETH

Solidity
error OnlyWETHError()

TransferError

Thrown when a transfer reverts

Solidity
error TransferError()

WrongConstructorParametersError

Thrown when the constructor parameters are wrong

Solidity
error WrongConstructorParametersError()