ekonomia-tech / protocol-alpha

Alpha version of a DeFi stablecoin protocol
GNU General Public License v3.0
4 stars 0 forks source link

Niv/cdp cli #99

Open nmimran99 opened 1 year ago

nmimran99 commented 1 year ago

Add CLI Commands to interact with CDP Pool. Currently only written for wstETH CDP pool. A generic CDP Pool interaction with different token is coming up.

commands: basic command npx ts-node cli/cli -c <networkId> -m <mnemonic> -n <accountNumber>

Dictionary: depositToken = [ steth | weth | eth ] amounts = without decimals. e.g. for 2 ETH = 2, for 1200 PHO = 1200

Write commands: <baseCommand> modules cdp open wsteth <depositToken> <collateralAmount> <debtAmount> <baseCommand> modules cdp add-collateral wsteth <depositToken> <collateralAmount> <baseCommand> modules cdp remove-collateral wsteth <collateralAmount> <baseCommand> modules cdp add-debt wsteth <debtAmount> <baseCommand> modules cdp remove-debt wsteth <debtAmount> <baseCommand> modules cdp close wsteth <baseCommand> modules cdp liquidate wsteth <cdpOwner> To be called by liquidator

Read command: <baseCommand> modules cdp overview wsteth <baseCommand> modules cdp position wsteth <cdpOwner>

General notes: The caller will have to manually get the deposit token, meaning converting ETH to WSTETH/STETH/WETH. If the caller is calling to the mainet fork, the approval to use these token by the wrapper contract will be done automatically, otherwise the caller will have to manually approve the wrapper contract to transferFrom.

The CLI was tested with deposit token as stETH only for now. I will further test with other tokens.