-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Description
- Transfer agent needs to call this function on the Factory contract,
function supportTokens(bytes32 _currency, address _address) onlyManager(msg.sender) external- where currency and address are the names and address of tokens that bond issuers can post as collateral, and bond purchasers can use to buy issued bonds. - Borrower (bond issuer) calls this function on the Bond contract for the currency it wants to issue the bond in (eg, USD) -
function requestIssue(uint256 amount, address payer, bytes32 currency, address cashContract) nonReentrant external returns(bool), where, amount is value of collateral borrower is posting, payer is the borrower's or the borrower's manager wallet address (in this case, it will be our compound contract address), currency is the collateral name, and currencyContract is the collateral address. - Once Bond is issued, a Bond token is created and the Bond issuer needs to call this function on the Factory contract -
function setBondTerm(address _bondToken, uint256 _term) external, where, term is the time for which the bond is issued for in seconds. - Once Bond token is created, the following function needs to be called by the Bond issuer on the Compound contract also,
function submitNewRWA(address asset, address bond, uint256 apy, string memory issuingDocs, uint256 paymentFrequency, address factory) external, where asset is the address of collateral posted by Bond issuer in step 2 above, bond is the address of Bond token created, apy is the interest rate the Bond issuer wants to pay on the Bond, faceValue is the value of bond issued, and factory is the address of Factory contract. - Lender (bond purchaser) calls this function on the Bond Token address which is issued in the previous step 2 above -
function requestTransaction(uint256 amount, address payer, bytes32 currency, address cashContract) nonReentrant external returns(bool), where amount is value of purchase, payer is the purchaser wallet, currency is the name of token with which bond is purchased, and cashContract is the purchasing token address. - Once the Bond tokens are purchased, the Bond issuer needs to call the following function on the Compound contract
function postCollateral(address bond, address issuer, address factory) external, where the bond token address, bond issuing contract address, and factory contract address are passed as parameters. Please check the postCollateral() function code carefully and test it on sepolia because it checks a lot of things, and also does calculations using interest rates which need to be precise. This function deposits collateral with Compound protocol. - The Bond issuer can then call the following function on the Compound contract,
function borrowBase(address asset) externalwhere asset is the address of the RWA posted as collateral by the Bond issuer to borrow base token, which calculates the value of a zero coupon bond for the tenue and apy of the bond, and then pays a part to the issuer and re-deposits the balance of base token to the Compound protocol to earn interest. - The Bond issuer can repay what it had borrowed by the first calling the following function on the Compound contract,
function repayBase(address asset, uint256 amount, address issuer) external, where asset is the RWA collateral it had posted to issue the bnd, amount is the base token it had borrowed and issuer is the address of the bond issuing contract. This returns the collateral back to the Bond issuing contract. - The Bond purchaser (lender) can then withdraw collateral from the Compound contract using the following function
function withdrawCollateral(address bond, address issuer, address factory) nonReentrant external, where bond is address of the Bond token, issuer is the Bond issuing contract, and factory is the address of the Factory contract. - The Bond issuer can claim back collateral it has posted for the issue of a bond for the amount that is unsold by calling the following function on the Bond token,
function transferFrom(address sender, address receiver, uint256 tokens) nonReentrant public returns (bool), where receiver is the address of the Bond token itself. - The Bond purchaser can liquidate a bond if it has not got paid after tenure of bond is over by calling the following function on the Bond token address,
function transferFrom(address sender, address receiver, uint256 tokens) nonReentrant public returns (bool), where receiver is the address of the Bond token itself. - The Bond issuer should pay interest based on payment frequency specified in the submitNewRWA function by calling the following function on the Compound contract,
function repayLenders(address asset, address collateral) nonReentrant external.
Metadata
Metadata
Assignees
Labels
No labels