RemoteDefiiPrincipal contract
The RemoteDefiiPrincipal contract is responsible for interacting with the Vault and managing user liquidity. This contract is deployed on the same chain as the Vault. RemoteDefiiPrincipal is an ERC20 token that represents the share of liquidity in DEFII. Contract mints DEFII LP token.
The contract interacts with RemoteDefiiAgent using LayerZero. The contract can exchange messages with RemoteDefiiAgent and bridge liquidity deposited through the Vault.
Read Functions
FUNDS_HOLDER
Returns the address of the FundsHolder smart contract where liquidity is stored for cross-chain interactions.
OPERATOR_REGISTRY
Returns the address of the OperatorRegistry smart contract where user approvals for operators are stored.
REMOTE_CHAIN_ID
The identifier of the chain on which RemoteDefiiPrincipal operates.
notion
Returns the address of the notion token.
defiiType
Returns the defiiType. For RemoteDefii, this is always 1.
positionBalance
Returns the balance of the owner's position in the Vault.
vault
address
Vault address
positionId
uint256
Position ID in Vault
owner
address
Position owner
token
address
Token address
quoteLayerZeroFee
Calculates the LayerZero fee for cross-chain message transmission.
calldata
bytes
Message calldata
payInZRO
bool
Always false
lzAdapterParams
bytes
LayerZero adapter parameters
remoteCallType
Message broker type. Currently, only LayerZero is supported.
supportedTokens
Tokens supported by DEFII. The list of tokens is determined during the deployment of the LocalDefii smart contract.
Write Functions
enter
Initiates entry into DEFII.
Accepts notion tokens.
Executes the BRIDGE or SWAP_BRIDGE instruction. Tokens are sent to the remote chain with a message that the remoteChainAgent should initiate entry into the third-party protocol.
Returns the remaining amount to the depositor after executing the instructions.
amount
uint256
Amount of notion tokens for deposit
positionId
uint256
Position ID in Vault
instructions
Instruction[]
Set of instructions
exit
Initiates an exit from DEFII. Burns DEFII LP and sends a command to remoteDefiiAgent to credit DEFII LP tokens to the owner. (clarification is needed)
shares
uint256
Amount of shares
positionId
uint256
Position ID in Vault
instructions
Instruction[]
Set of instructions
finishRemoteExit
Completes the withdrawal of funds from remoteDefii. It is expected that the output tokens have already arrived at FUNDS_HOLDER. The following actions are performed:
Takes tokens from FUNDS_HOLDER.
Swaps tokens for notion.
Sends the received tokens to the Vault.
vault
uint256
Vault address
positionId
uint256
Position ID in Vault
instructions
Instruction[]
Set of instructions
lzReceive
mintShares
Mints DEFII LP tokens after a successful entry into remoteDefii. Can only be called by remoteDefiiPrincipal itself after receiving a command from remoteDefiiAgent.
vault
uint256
Vault address
positionId
uint256
Position ID in Vault
shares
uint256
Amount of share to be minted
receiveTokenWithMessage
Takes tokens from msg.sender and transfers them to FUNDS_HOLDER for further movement to the remote chain.
token
address
Token address
amount
uint256
Amount of tokens
message
bytes
Message received from the message broker.
withdrawFunds
Withdraws tokens to the address of msg.sender.
vault
uint256
Vault address
positionId
uint256
Position ID in Vault
token
address
Token amount
amount
uint256
Amount of token
withdrawLiquidity
Initiates the withdrawal of liquidity to the recipient's address and burns their DEFII LP tokens.
recipient
address
Recipient address
shares
uint256
Amount of shares to be withdrawn
instructions
Instruction[]
Set of instructions
Last updated