> For the complete documentation index, see [llms.txt](https://docs.re.al/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.re.al/rwa-token/contracts/rwa-technical.md).

# RWA Technical

## CrossChainMigrator

### Key Methods

All migrate methods contain an extra parameter, \`\_airdropData\`. This argument is used in the event the migrator wants to receive an airdrop of native ETH on the destination chain. For more info on how to use this param: <https://layerzero.gitbook.io/docs/evm-guides/advanced/relayer-adapter-parameters>

msg.value for each migrate method must not be 0. It is used to specify (and pay) an amount of gas for consumption on the destination chain. You can get a gas quote from \`endpoint::estimateFees()\`.

#### **migrateNFT**

{% code overflow="wrap" %}

```javascript
function migrateNFT(uint256 _tokenId, address to, address payable refundAddress, address zroPaymentAddress, bytes calldata adapterParams) payable external;
```

{% endcode %}

Used to migrate a single PassiveIncome NFT from Polygon to Real chain. This method will take a user's PI NFT specified and send a message to the Polygon LayerZero endpoint to be later passed to the destination chain.

#### **migrateNFTBatch**

{% code overflow="wrap" %}

```javascript
function migrateNFTBatch(uint256[] memory _tokenIds, address to, address payable refundAddress, address zroPaymentAddress, bytes calldata adapterParams) payable external;
```

{% endcode %}

This method is used to migrate a batch of PassiveIncome NFTs from Polygon to Real chain. This method will take a user's PI NFTs specified and send a message to the Polygon LayerZero endpoint to be later passed to the destination chain for a batch migration.

#### **migrateTokens**

{% code overflow="wrap" %}

```javascript
function migrateTokens(uint256 _amountaddress to, address payable refundAddress, address zroPaymentAddress, bytes calldata adapterParams) payable external;
```

{% endcode %}

This method is used to migrate TNGBL tokens from Polygon to RWA on Real chain. This method will burn TNGBL tokens from the migrator then send a mintFor message to the RWA contract on Real chain.

## RealReceiver

### Key Methods

#### **lzReceive**

{% code overflow="wrap" %}

```javascript
function lzReceive(uint16 _srcChainId, bytes calldata _srcAddress, uint64 _nonce, bytes calldata _payload) external;
```

{% endcode %}

LayerZero endpoint will invoke this function to deliver the message on the destination.

## RevenueDistributor

### Key Methods

#### **convertRewardToken**

{% code overflow="wrap" %}

```javascript
function convertRewardToken(address _token,uint256 _amount,address _target,bytes calldata _data) external;
```

{% endcode %}

Converts a specific revenue token to ETH and distributes it to the revenue stream.

#### **convertRewardTokenBatch**

{% code overflow="wrap" %}

```javascript
function convertRewardTokenBatch(address[] memory _token,uint256[] memory _amount,address[] memory _target,bytes[] memory calldata _data) external;
```

{% endcode %}

Converts a batch of revenue tokens to ETH and distribute to the revenue stream.

#### **addRevenueToken**

{% code overflow="wrap" %}

```javascript
function addRevenueToken(address _revToken) external;
```

{% endcode %}

This method is used to add a new supported revenue token.

#### **removeRevenueToken**

{% code overflow="wrap" %}

```javascript
function removeRevenueToken(address _revToken) external;
```

{% endcode %}

This method is used to remove an existing revenue token.

#### **setSelectorForTarget**

{% code overflow="wrap" %}

```javascript
function setSelectorForTarget(address _target, bytes4 _selector) external;
```

{% endcode %}

This method sets the verified function call for a \`\_target\`.

* Calldata cannot be used in conversion calls unless it’s added here.

#### **distributeStreamETH**

{% code overflow="wrap" %}

```javascript
function distributeStreamETH() external;
```

{% endcode %}

This method distributes an ETH revenue stream to the RevenueStreamETH contract.

## RevenueStreamETH

### Key Methods

#### **depositETH**

{% code overflow="wrap" %}

```javascript
function depositETH() payable external;
```

{% endcode %}

This method is used to deposit ETH into the contract to be claimed by shareholders.

#### **claimETH**

{% code overflow="wrap" %}

```javascript
function claimETH(address account) external returns (uint256 amount);
```

{% endcode %}

This method allows eligible VE shareholders to claim their ETH revenue rewards by account.

#### **claimable**

{% code overflow="wrap" %}

```javascript
function claimable(address account) external view returns (uint256 amount);
```

{% endcode %}

View method that returns an amount of ETH revenue that is claimable, given a specific \`account\`.

#### claimWithSignature

```javascript
function claimWithSignature(uint256 amount, uint256 currentIndex, uint256 indexes, uint256 deadline, bytes calldata signature) external;
```

This method allows a user to perform a claim with data that has been verified via a signature from the dedicated `signer` address.

**How is the `signature` generated?**\
The arguments given to the `claimWithSignature` function must be verified and signed by our designated signer wallet before that data can be passed into the method. When a claim is initiated by a user, the function params are first obtained via the `claimable` method and `lastClaimIndex`. This data is then signed by our node and passed back to the application so the user can complete the claim with the verified arguments.

## RWAVotingEscrow

### Key Methods

#### **mint**

{% code overflow="wrap" %}

```javascript
function mint(address _receiver, uint208 _lockedBalance, uint256 _duration) external returns (uint256 tokenId);
```

{% endcode %}

Mints a new VotingEscrow token representing a locked token position. The minting process locks a specified amount of tokens for a given vesting duration, assigning voting power accordingly.

#### **migrate**

{% code overflow="wrap" %}

```javascript
function migrate(address _receiver, uint256 _lockedBalance, uint256 _duration) external returns (uint256 tokenId);
```

{% endcode %}

This method is called by the RealReceiverNFT contract to fulfill the cross-chain migration from 3,3+ to veRWA.

#### **migrateBatch**

{% code overflow="wrap" %}

```javascript
function migrateBatch(address _receiver, uint256[] memory _lockedBalances, uint256[] memory _durations) external returns (uint256[] memory tokenIds);
```

{% endcode %}

This method is called by the RealReceiverNFT contract to fulfill the cross-chain migration of a batch of 3,3+ NFTs to veRWA NFTs.

#### **burn**

{% code overflow="wrap" %}

```javascript
function burn(address receiver, uint256 tokenId) external;
```

{% endcode %}

Burns a VotingEscrow token, releasing the locked tokens to the specified receiver. The burning process can only be done once the vesting duration has finished.

* If the lock duration remaining on lock is not 0, a penalty will be applied to the release of locked tokens.

#### **merge**

{% code overflow="wrap" %}

```javascript
function merge(uint256 tokenId, uint256 intoTokenId) external;
```

{% endcode %}

Merges two VotingEscrow tokens into one, combining their locked balances and vesting durations. The merge process adjusts the voting power based on the new combined balance and vesting duration.

#### **split**

{% code overflow="wrap" %}

```javascript
function split(uint256 tokenId, uint256[] calldata shares) external returns (uint256[] memory tokenIds);
```

{% endcode %}

Splits a VotingEscrow token into multiple tokens based on specified shares. The split process divides the locked balance and retains the original vesting duration for each new token.

#### **getPastTotalVotingPower**

{% code overflow="wrap" %}

```javascript
function getPastTotalVotingPower(uint256 timepoint) external view returns (uint256);
```

{% endcode %}

Returns the most recent checkpoint (given a timestamp) for total voting power.

#### **getPastVotingPower**

{% code overflow="wrap" %}

```javascript
function getPastVotingPower(uint256 tokenId, uint256 timepoint) external view returns (uint256);
```

{% endcode %}

Returns the most recent voting power checkpoint (given a timestamp) for a specific tokenId.

## VotingEscrowVesting

### Key Methods

#### **deposit**

{% code overflow="wrap" %}

```javascript
function deposit(uint256 tokenId) external nonReentrant;
```

{% endcode %}

Deposits a VotingEscrow token to start it's vesting schedule. The function records the vesting schedule, removes the token's voting power, and transfers the token to this contract for vesting.

#### **withdraw**

{% code overflow="wrap" %}

```javascript
function withdraw(address receiver, uint256 tokenId) external nonReentrant;
```

{% endcode %}

Withdraws a VotingEscrow token back to the depositor after the vesting period. The function restores the remaining vesting duration and transfers the token back to the depositor.

#### **claim**

{% code overflow="wrap" %}

```javascript
function claim(address receiver, uint256 tokenId) external nonReentrant;
```

{% endcode %}

Claims the underlying locked tokens of a vested VotingEscrow token, effectively burning the VotingEscrow token. The function can only be called once the vesting period has completed.

* If the remaining lock duration was not 0, will apply the early-burn penalty.

## DelegateFactory

### Key Methods

#### **deployDelegator**

{% code overflow="wrap" %}

```javascript
function deployDelegator(uint256 _tokenId, address _delegatee, uint256 _duration) external returns (address newDelegator);
```

{% endcode %}

This method allows a permissioned address to create a delegator contract.

#### **revokeExpiredDelegators**

{% code overflow="wrap" %}

```javascript
function revokeExpiredDelegators() external;
```

{% endcode %}

This method is used to fetch any expired Delegators, withdraw the delegated token from the Delegator, and delete its instance from the factory contract.

#### **expiredDelegatorExists**

{% code overflow="wrap" %}

```javascript
function expiredDelegatorExists() external view returns (bool exists);
```

{% endcode %}

This view method is used to fetch whether there exists any expired delegators.

## Delegator

### Key Methods

#### **depositDelegatorToken**

{% code overflow="wrap" %}

```javascript
function depositDelegatorToken(uint256 _tokenId) external;
```

{% endcode %}

This method is used to deposit a delegated veRWA NFT into this contract.

#### **withdrawDelegatedToken**

{% code overflow="wrap" %}

```javascript
function withdrawDelegatedToken() external;
```

{% endcode %}

This method is used to transfer the \`delegatedToken\` back to the \`creator\`.

<br>
