-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calls / APIs for web extension #1
Comments
kallolborah
assigned kallolborah and devbeast0121 and unassigned vinaykumar0103 and kallolborah
Dec 26, 2023
@kallolborah |
@Mohzcrea8me adding test code for bond liquidation and redemption
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here is a list of the calls to make using the Verified SDK - you need to install the latest version of the verified sdk from npm. And you can simply use the wallet connected to the web extension by Compound to call the verified sdk APIs below.
Note : you need to have whatever collateral you are posting as a user to Compound in your wallet. Collateral can only be assets that is accepted by Compound, so check what they accept and get some of them on goerli for free to test.
Buttons :
There are two calls to make here -
a) issue the bond by calling the bond contract
function requestIssue(uint256 amount, address payer, bytes32 collateralName, address collateral)
where, collateral is usually a security token issued on the Verified Network, which is then approved by the issuer's agent (DP) by a call to the factory contract
function supportTokens(bytes32 _currency, address _address)
b) call the operator contract to submit issued bond details
function submitNewRWA(address asset, address bond, uint256 apy, string memory issuingDocs, uint256 faceValue)
where, asset is the security token used to issue the bond and
where, the bond address is emitted when the bond is issued and can be retrieved using the subgraph.
a) Investor provides collateral to RWA issuer by buying the issued bond by calling the Token contract on the bond address
function requestTransaction(uint256 amount, address payer, bytes32 collateralName, address collateralContract)
where, currency is the name of the collateral such as 'DAI' or 'WETH' acceptable on both Compound and Verified.
a) first, issuer posts collateral to Compound by calling the operator contract
function postCollateral(address asset, address collateral, uint256 amount)
where, base is always the USDC address on the chain linked to the signed in wallet.
b) then, issuer borrows from Compound by calling the operator contract
function borrowBase(address base, uint256 amount)
where, base is always the USDC address on the chain linked to the signed in wallet. This function will only work if sufficient collateral has been posted for the USDC amount requested for borrowing.
a) here, issuer repays the loan to investors by calling the Token contract on the bond address
function requestTransaction(uint256 amount, address payer, bytes32 collateralName, address collateralContract)
where, collateral is what was used to buy the bond issued earlier.
a) issuer repays to Compound by calling the operator contract
function repayBase(address base, uint256 amount)
where, base is always the USDC address on the chain linked to the signed in wallet.
a) if issuer defaults in redeeming collateral (ie, repaying loan) to investors, then investors can claim the RWA tokens locked in the bond contract by calling the Token contract on the bond address
function transferFrom(address sender, address receiver, uint256 tokens)
where, the sender is the investor wallet address, receiver is the Bond token address and amount is bond tokens being redeemed by the investor.
The text was updated successfully, but these errors were encountered: