Skip to content
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

Open
kallolborah opened this issue Aug 11, 2023 · 1 comment
Open

Calls / APIs for web extension #1

kallolborah opened this issue Aug 11, 2023 · 1 comment
Assignees

Comments

@kallolborah
Copy link
Member

kallolborah commented Aug 11, 2023

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 :

  1. Issuer UI - Issue new RWA -> on submit of Asset issuance form

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.

  1. Investor UI - Buy issue [to do : change text from 'Buy issue' to 'Provide collateral']

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.

  1. Issuer UI - Borrow

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.

  1. Issuer UI - Redeem collateral

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.

  1. Issuer UI - Repay loan

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.

  1. Investor UI - Redeem issue [to do : change text from 'Redeem issue' to 'Liquidate collateral']

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.

kallolborah referenced this issue Nov 19, 2023
call a functions are  1(b), 3(a) and 3(b), and 5(a)
@Mohzcrea8me
Copy link
Collaborator

Mohzcrea8me commented Feb 9, 2024

issuingDocs

@kallolborah
1a is handled, b needs issuing docs i believe it's an ipfs link to the docs uploade. which ipfs details should i use?

@Mohzcrea8me Mohzcrea8me self-assigned this Mar 14, 2024
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

No branches or pull requests

5 participants