PErc20CrossChain
The PErc20CrossChain contract extends the standard PErc20 lending functionality to support cross-chain operations, allowing the authorized PeridotHubHandler to mint and borrow on behalf of users from spoke chains.
🛠️ Key Functions & Parameters
✅ mintFor(address user, uint256 mintAmount)
Mints pTokens for a user on behalf of the hub handler for cross-chain supply operations.
Parameters:
user
: Address of the user on the hub chain to mint pTokens formintAmount
: Amount of underlying asset being supplied
Process:
Accrues interest to ensure up-to-date calculations
Validates mint is allowed by the Peridottroller
Transfers underlying tokens from hub handler to the pToken contract
Calculates and mints appropriate amount of pTokens for the user
Updates total supply and user's token balance
Access Control: Only callable by the authorized hub handler contract.
✅ borrowFor(address user, uint256 borrowAmount)
Processes borrow requests for users from spoke chains, updating debt and transferring tokens to hub handler.
Parameters:
user
: Address of the user on the hub chain who is borrowingborrowAmount
: Amount of underlying asset to borrow
Process:
Accrues interest to ensure accurate debt calculations
Validates borrow is allowed by the Peridottroller (checks collateral, etc.)
Updates user's borrow balance and total borrows
Transfers borrowed tokens to hub handler for cross-chain delivery
Access Control: Only callable by the authorized hub handler contract.
Last updated