Smart Contracts/Architecture
This section will cover all the smart contracts that YieldBlox uses. These contracts are all sub-contracts in the same master smart contract. But they are each handled independently and entered with a global event handler.
Global Request Fields
The following fields are shared between all smart contract requests.
userPublicKey: user public key
timestamp: current timestamp, if it is not from the last 5 minutes the smart contract will reject the request.
type: Protocol function the user is requesting, stored as the following enum:
Other general contract information
Balance Line Objects
The BalanceLine object is often used to represent an asset (using an assetId) and an amount of that asset. It is the following object:
Repay Path Objects
The RepayPath object is used in repayments and liquidations to represent a path payment that should be taken to liquidate user collateral during a liquidation with collateral. The assetId fields in the object should represent underlying assets. The asset is as follows:
NOTE: The object in the smart contract uses BigNumber objects for the amounts represented in the object. However, users should still input strings in their requests. The contract will handle transforming the object when it ingests the request.
AssetId Entries
assetId entries are strings that represent asset objects. They are structured as {assetCode}:{assetIssuer}.
PathPayment Handling
Whenever a pathPayment
operation is used the contract first finds the most efficient path first and passes it into the operation.
Last updated