# Smart Contract Integration

The system is composed of two main modules: **iAsset** and **PoEL**. &#x20;

#### SUPRA

<table><thead><tr><th width="97.6221923828125">Status</th><th width="272.4112548828125">Contract Address</th><th>Modules Link</th></tr></thead><tbody><tr><td>Testnet</td><td>0xc4a734e5b84deb218ab7ba5a46af45da54d5ff4aa8846e842c3ac2e32ce0eebd</td><td>https://testnet.suprascan.io/address/0xc4a734e5b84deb218ab7ba5a46af45da54d5ff4aa8846e842c3ac2e32ce0eebd/f?tab=modules</td></tr><tr><td>Mainnet</td><td>0xda20f7d0ec813c751926f06004a10bc6ee1eefc96798f6a1aa31447ee146f932</td><td>https://suprascan.io/address/0xda20f7d0ec813c751926f06004a10bc6ee1eefc96798f6a1aa31447ee146f932/f?tab=modules</td></tr></tbody></table>

#### Ethereum

| Mainnet Deployed          | Contract Address                           |
| ------------------------- | ------------------------------------------ |
| Multisig admin (9/16)     | 0xb09eE905aFfb96E4da95D50ed946cDa696C8FF1D |
| FeeOperatorImpl           | 0xB69e964cA6cD9D9E02202A636e222469b97D8e32 |
| FeeOperatorProxy          | 0x6CA8244fF976DCa12d0260662cCE4483b4945BFF |
| TokenBridgeImplementation | 0xE7Bb5770D83f42a96e62B3034643d92139477009 |
| TokenBridgeProxy          | 0x573330c2F115FB1C1fBa3220f072f2eF9F411eC2 |
| VaultImplementation       | 0x9C9D5879eB96a7A037eA2b58196e342e93D80004 |
| VaultProxy                | 0x548957c5b25f6831382D848b9806459cdfBD048E |

| TESTNET Deployed          | Contract Address                           |
| ------------------------- | ------------------------------------------ |
| FeeOperatorImpl           | 0x651b7a3a747CC75B33cEbF5c0740B69954EB5Bc0 |
| FeeOperatorProxy          | 0xcd06057e8642613C38b938EFbe4FB44734920e2a |
| TokenBridgeImplementation | 0x64ea2A2F3A9adADf42E21C7ed88fff5f87032990 |
| TokenBridgeProxy          | 0x7a5157c9A2F449f0EDDBa591327Ae1215c63ec75 |
| VaultImplementation       | 0x4efB9F7C6E1155E315c2dFEecEA0AEa7Bc88FD5F |
| VaultProxy                | 0x70FeF9A2fF27Fd834E41D6b281A9e82Afc75305d |

{% hint style="info" %}
dApps that hold iAssets (e.g., liquidity pools) and need to withdraw rewards periodically can use the following methods from the PoEL and iAsset modules.
{% endhint %}

### Methods Used During Integration

<table><thead><tr><th width="259.78125">Method</th><th width="353.300537109375">In / out </th><th>Comment</th></tr></thead><tbody><tr><td><p><kbd>View method</kbd> </p><p></p><p><code>get_user_rewards</code></p><p>(user_address: address): UserRewardsInfo</p></td><td><p></p><p><kbd>in</kbd> </p><p></p><p><code>user_address</code>: </p><p>address of the iasset holder</p><p></p><p><kbd>out</kbd> </p><p></p><p><code>UserRewardsInfo</code> result object with various details. </p><p></p><p><kbd>Fields</kbd>:</p><p></p><ul><li>Allocated rewards for a user <code>allocated_rewards</code>: u64,</li><li>Withdrawable (claimed) rewards for a <code>user withdrawable_rewards</code>: u64,</li><li>Epoch when rewards were claimed (moved to withdrawable) <code>withdrawable_rewards_epoch</code>: u64,</li><li>Timestamp when rewards were claimed (moved to withdrawable) <code>withdrawable_rewards_ts</code>: u64,</li><li>Withdrawn rewards for a user <br><code>withdrawn_rewards</code>: u64</li></ul></td><td>Method returns total allocated rewards, withdrawable, withdrawn etc</td></tr><tr><td><p><kbd>View method</kbd> </p><p></p><p><code>get_allocatable_rewards</code></p><p>(user_address: address, asset: Object&#x3C;Metadata>): u64</p></td><td><p><kbd>in</kbd></p><p><code>user_address</code>: </p><p>address of the iasset holder</p><p><code>asset</code> : iasset object<br></p><p><kbd>out</kbd></p><p>amount of supra coins</p></td><td>Return number of rewards could be allocated by calling method update_rewards</td></tr><tr><td><p><kbd>View method</kbd> </p><p></p><p><code>get_withdraw_timer_for_user</code></p><p>(user_address: address): u64</p></td><td><p><kbd>in</kbd> </p><p></p><p><code>user_address</code>: address of the iasset holder</p></td><td>Method is useful for the claim/withdraw scenario. This method indicates the remaining time to wait until withdraw_rewards can be invoked</td></tr></tbody></table>

## PoEL Module

<table><thead><tr><th width="250.93182373046875">Method</th><th width="246.03118896484375">In / out </th><th>Comment</th></tr></thead><tbody><tr><td><code>update_rewards</code>(account: &#x26;signer, asset: Object)</td><td><p><kbd>in</kbd><br></p><p><code>account</code>: signer, who updates the rewards</p><p><br><code>asset</code> : iasset object, for which rewards has to be updated</p></td><td>Call this method whenever get_allocatable_rewards returns a non-zero value</td></tr><tr><td><code>claim_rewards</code>(account: &#x26;signer)</td><td><p><kbd>in</kbd><br></p><p><code>account</code>: signer, who claims already allocated rewards</p></td><td>Call this method only when allocated_reward>0</td></tr><tr><td><code>withdraw_rewards</code>(account: &#x26;signer)</td><td><p><kbd>in</kbd><br></p><p><code>account</code>: signer, who withdraw already claimed rewards</p></td><td>Method can be called if withdrawable_rewards not 0 (something claimed) and Get_withdraw_timer_for_user is 0</td></tr></tbody></table>
