๐Contracts
Using Brownie you can interact with the Ooki contracts. Below is an explanation for using each function. See our github for additional references: https://github.com/bZxNetwork/contractsV2
OOKI Token Contract
0x0De05F6447ab4D22c8827449EE4bA2D5C288379B
cOOKI/vBZRX Contract
0xb72b31907c1c95f3650b64b2469e08edacee5e8f
MintCoordinator
0x93c608Dc45FcDd9e7c5457ce6fc7f4dDec235b68
IToken Contract
Router Contract
Functions
Load protocol
BZX = Contract.from_abi("BZX", "0xfe4F0eb0A1Ad109185c9AaDE64C48ff8e928e54B", interface.IBZx.abi)
Load iTokens
iUSDTAddress = BZX.underlyingToLoanPool(USDT.address)
iUSDT = Contract.from_abi("iUSDT", address=iUSDTAddress, abi=LoanTokenLogicStandard.abi)
Approve
WMATIC.approve(iUSDT, 2256-1, {'from': accounts[0]})
USDT.approve(BZX, 2256-1, {'from': accounts[0]})
WMATIC.approve(BZX, 2**256-1, {'from': accounts[0]})
Open Long 5x MATIC/USDT (using matic as collateral)
Deposit collateral
BZX.depositCollateral(loan[0], 10e18, {'from': accounts[0]})
Close loan with swap
BZX.closeWithSwap(loan[0], accounts[0], loan[5], True, b'', {'from': accounts[0]})
Close loan with deposit
BZX.closeWithDeposit(loan[0], accounts[0], loan[4], {'from': accounts[0]})
Get loans
loans = BZX.getActiveLoansAdvanced(0,100,True,True)
loan = loans[0]
Returning loan and getting collateral:
BZX.liquidate(loan[0], accounts[0], loan[13], {'from': accounts[0]})
Rollover
BZX.rollover(loan[0], b'', {'from':accounts[0]})
Flash loans/Flash borrow
Flashborrow has the following arguments:
flashBorrow(uint256 borrowAmount, address borrower, address target, string signature, bytes data), it should be call from contract layer.
Example can be found https://github.com/bZxNetwork/flashloan-sample
Last updated