Skip to content

Conversation

@08xmt
Copy link
Contributor

@08xmt 08xmt commented Oct 3, 2024

Base branch for firmv2

interface IEscrow {
function initialize(IERC20 _token, address beneficiary) external;
function onDeposit() external;
function onDepositCallBack() external returns(uint);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's this function?

interface IDebtManager {
function debt(address borrower) external view returns(uint);
function totalDebt() external view returns(uint);
function dbrDeficit(address borrower) external view returns(uint);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Debt managers shouldn't have to deal with DBR and therefore this function shouldn't be on the interface. Maybe it can be replaced with a boolean inDeficit(address) returns (bool) function which would be universal whether using DBR or not.

function dbrDeficit(address borrower) external view returns(uint);
function increaseDebt(address borrower, uint amount) external;
function decreaseDebt(address borrower, uint amount) external returns(uint);
function replenish(address borrower, uint amount) external;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems unused? imo replenishments can happen through the debt manager contract directly. Doesn't have to be done through the market anyway.

keccak256(
abi.encode(
keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
keccak256(bytes("DBR MARKET")),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
keccak256(bytes("DBR MARKET")),
keccak256(bytes("FiRM MARKET")),

function withdrawInternal(address from, address to, uint amount) internal {
uint limit = getWithdrawalLimitInternal(from);
require(limit >= amount, "Insufficient withdrawal limit");
require(dbr.deficitOf(from) == 0, "Can't withdraw with DBR deficit");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this rule still apply? I think it should be replaced with the user's debtManager's deficit instead, no?

@08xmt 08xmt changed the title Add marketv2 Epic: FiRMv2 Nov 8, 2024
* Liquidation incentive linearly increase as borrower collateral factor decreases
* Liquidation fee linearly decreases  as borrower collateral factor decreases
* Remove collateral factor, instead add max liquidation amount
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants