ERC4626DebtToken
Inherits: ERC4626, ERC20DebtBase
Functions
constructor
constructor(ERC20BaseConfig memory config, address _asset) ERC4626(IERC20(_asset)) ERC20DebtBase(config);
ownerMint
function ownerMint(
address sender,
address to,
uint256 assets,
uint256 shares
) public virtual override(ERC20Base, IAmmalgamERC20) onlyOwner;
ownerBurn
function ownerBurn(
address sender,
address onBehalfOf,
uint256 assets,
uint256 shares
) public virtual override(IAmmalgamERC20) onlyOwner;
borrowCall
We use the callback to transfer debt to the caller and transfer borrowed assets to the receiver. This contract never has assets or shares unless they were sent to it by the pair within the context of this function getting called. Calling this function directly will not do anything because there are no assets or shares to transfer.
TODO(#547): Shares and assets need testing.
function borrowCall(address sender, uint256 assetsX, uint256 assetsY, uint256, bytes calldata data) public virtual;
Parameters
Name | Type | Description |
---|---|---|
sender | address | |
assetsX | uint256 | amount of tokenX sent to this contract |
assetsY | uint256 | amount of tokenY sent to this contract |
<none> | uint256 | |
data | bytes | encoded data containing the caller and receiver addresses |
_deposit
ERC4626 facade for IAmmalgamPair-borrow. both deposit and mint calls _deposit This is called when the user is borrowing
function _deposit(address caller, address receiver, uint256 assets, uint256) internal virtual override;
_withdraw
ERC4626 facade for IAmmalgamPair-repay. both withdraw and redeem calls _withdraw This is called when the user is repaying their debt
function _withdraw(address caller, address receiver, address, uint256 assets, uint256) internal virtual override;
approve
function approve(address account, uint256 balance) public pure override(ERC20, ERC20DebtBase, IERC20) returns (bool);
allowance
function allowance(
address owner,
address spender
) public view override(ERC20, ERC20DebtBase, IERC20) returns (uint256);
decimals
function decimals() public view override(ERC20Base, ERC4626, IERC20Metadata) returns (uint8);
totalAssets
function totalAssets() public view override returns (uint256);
transfer
function transfer(address recipient, uint256 amount) public override(ERC20, IERC20, ERC20DebtBase) returns (bool);
transferFrom
function transferFrom(
address sender,
address recipient,
uint256 amount
) public override(ERC20, IERC20, ERC20DebtBase) returns (bool);
_update
function _update(address from, address to, uint256 amount) internal virtual override(ERC20, ERC20Base);
_spendAllowance
function _spendAllowance(
address owner,
address spender,
uint256 amount
) internal virtual override(ERC20DebtBase, ERC20);
balanceOf
function balanceOf(
address account
) public view override(ERC20Base, IERC20, ERC20) returns (uint256);
_convertToShares
function _convertToShares(uint256 assets, Math.Rounding rounding) internal view override returns (uint256);
_convertToAssets
function _convertToAssets(uint256 shares, Math.Rounding rounding) internal view override returns (uint256);