Skip to content

Commit

Permalink
feat: add detailed documentation to RebaseTokenPool contract for impr…
Browse files Browse the repository at this point in the history
…oved clarity and maintainability
  • Loading branch information
sumit03guha committed Feb 16, 2025
1 parent acec81d commit 1514e6f
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/RebaseTokenPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,32 @@ import { TokenPool } from "@chainlink-contracts/ccip/pools/TokenPool.sol";

import { IRebaseToken } from "./interfaces/IRebaseToken.sol";

/**
* @title RebaseTokenPool
* @author sumit03guha
* @notice Pool contract for RebaseTokens supporting cross-chain operations.
* @dev Inherits from TokenPool and provides functionality to lock, burn, release, or mint tokens
* based on cross-chain messages.
*/
contract RebaseTokenPool is TokenPool {
/**
* @notice Initializes the RebaseTokenPool.
* @param token The ERC20 token managed by the pool.
* @param allowlist List of addresses allowed to interact with the pool.
* @param rmnProxy The address of the proxy for remote management.
* @param router The router address used for cross-chain transfers.
*/
constructor(IERC20 token, address[] memory allowlist, address rmnProxy, address router)
TokenPool(token, 18, allowlist, rmnProxy, router)
{ }

/**
* @notice Locks or burns tokens as part of a cross-chain operation.
* @param lockOrBurnIn The input parameters for locking or burning tokens.
* @return lockOrBurnOut The output parameters including destination token address and pool data.
* @dev Validates the operation, burns tokens from the pool, retrieves the user interest rate,
* and encodes it for use in cross-chain communication.
*/
function lockOrBurn(Pool.LockOrBurnInV1 calldata lockOrBurnIn)
external
returns (Pool.LockOrBurnOutV1 memory lockOrBurnOut)
Expand All @@ -30,6 +51,13 @@ contract RebaseTokenPool is TokenPool {
});
}

/**
* @notice Releases or mints tokens on the destination chain as part of a cross-chain operation.
* @param releaseOrMintIn The input parameters for the release or mint operation.
* @return The output parameters including the destination amount.
* @dev Validates the operation, decodes the source pool data to retrieve the user interest rate,
* and mints tokens to the receiver.
*/
function releaseOrMint(Pool.ReleaseOrMintInV1 calldata releaseOrMintIn)
external
returns (Pool.ReleaseOrMintOutV1 memory)
Expand Down

0 comments on commit 1514e6f

Please sign in to comment.