Skip to content

Latest commit

 

History

History
161 lines (118 loc) · 10.7 KB

Delegation Guide.md

File metadata and controls

161 lines (118 loc) · 10.7 KB

MOR Delegation Guide

Introduction

A Morpheus Compute Subnet is a specialized Compute Provider that offers "Inference" services (LLM and Diffusion Models) to users within the Morpheus ecosystem. To create a subnet, providers must stake a minimum of 10,000 MOR. This staking requirement ensures that only dedicated providers, who have made significant investments in both hardware and MOR tokens, can participate. This reduces the risk of bad actors entering the marketplace.

Additionally, MOR staked toward each subnet increases its Rank with the Router, enhancing the likelihood of being matched with users. This creates natural economic incentives for subnets to attract MOR and share rewards with MOR holders.

While MOR lend and borrow market is still under development, Morpheus has implemented a Delegation process that allows subnets (Delegatee) to stake MOR on behalf of users (Delegator) within the protocol.

This guide outlines the delegation process using the Arbitrum Sepolia testnet.

Important

  • A Subnet (Delegatee) wallet interacts with the protocol on behalf of the user (Delegator).

  • Delegator funds are NOT transferred to the Delegatee’s balance.

  • The Delegatee can ONLY transfer Delegator funds within the Morpheus Compute contract, ensuring security and limiting misuse.


Table of contents

  1. Smart Contract Addresses
  2. Delegate Contract
  3. Compute Contract Allowance
  4. Delegatee Transaction Execution
  5. Rules List

Delegation Video Guide

The video guide contains all the steps described in textbelow


Smart Contract Addresses

Arbitrum Mainnet

Arbitrum Sepolia (testnet)


Delegate Contract

This step performs by the Delegator and will assign a contract the Delegatee can interact with. The steps are:

  1. Go to the Delegate Registry smart contract deployed by delegate.xyz in the desired network (the same address for all chains) and connect your wallet.
  2. Open the "Contract" tab, then select the "Write Contract" tab.
  3. Call the delegateContract() and input the following parameters:
  • payable amount: 0;
  • to (address): Delegatee address (the address you want to delegate rights to);
  • contract (address): Compute Contract address (for testnet it's 0xDE819AaEE474626E3f34Ef0263373357e5a6C71b);
  • rights (bytes32): 0x0000000000000000000000000000000000000000000000000000000000000000 (full protocol rights);

This parameter restricts the Delegatee's actions within the protocol, for example, allow opening sessions, but forbid creating models. Here is the list of available right options.

  • enable (bool): true.
  1. Click "Write" and confirm the transaction in your wallet.

Tip

To verificate the operation, you can call checkDelegateForContract(). It should return “true”. Where “from”: Delegator's address, i.e. the address from which the delegation function was called. The rest of the parameters are the same as above.


Compute Contract Allowance

As the next step, the Delegator needs to give a permission to transfer MOR to the Compute contract. For this:

  1. Go to the MOR contract and connect your wallet.
  2. Open the "Contract" tab, then select the "Write Contract" tab.
  3. Call the approve() function and input the following parameters:
  • spender (address): the Compute contract address;
  • amount (uint256): MOR amount that's allowed to be transferred to the Compute contract (in wei).
  1. Click "Write" and confirm the transaction in your wallet.

Tip

You can check the permission by calling the allowance() function, where the owner will be the user's (Delegator) address and the spender will be the Compute contract address. The result will reflect the amount the Delegator allow Delegatee to transfer to the contract.


Delegatee Transaction Execution

Starting this step, further transactions need to be executed by the Delegatee.

Morpheus-Lumerin Compute architecture based on proxy contracts. This means that users cannot call all protocol methods through the block explorer.
For that we need to use: a) console; b) frontend; c) remix.

To interact with the protocol, Delegatee needs an ABI (application binary interface), that can be found in contracts:

To find the ABI you need to:

  1. Go to the one of the contracts listed above (depending on the operation).
  2. Open "Contract" tab and scroll down until you see "Contract ABI" section.
  3. Click "Copy ABI" button.

For showcase purpose, Delegatee will create the provider with Delegator's MOR. For this we need to copy the ABI from the ProviderRegistry.

  1. Copy ABI from the ProviderRegistry contract.
  2. Open https://remix.ethereum.org and open /contract folder.
  3. Create ProviderRegistry.abi file and paste ABI to it. Keep the file open.
  1. Go to the "Deploy & run transaction" section and connect your web3 wallet.
  2. Double check that correct Delegatee wallet is connected on the correct chain.
  1. Enter the Compute contract address in the “At Address” field and click the button.
    If everything has done correctly you should see should see Compute contract and its functions under "Deployed Contracts" section.
  1. Open the provider registration function and and input the following parameters:
  • provider_: Delegator's address (the one that gave delegation rights);
  • amount_: provider registration price in wei, but no more than you approved at Compute Contract Allowance step.
  • endpoint_: AAA.
  1. Click "transact" and confirm the transaction in your wallet.

Here is the example transaction where caller and provider are different addresses and MOR were transferred from the Delegator's address.
https://sepolia.arbiscan.io/tx/0x9ab24642a74bfe27ce905f569538c5cb1c428add55fd04c0469f959625742191

The rest of the functionality works according to a similar principle.


Rules List

Choose one according to needs:

  • 0x0000000000000000000000000000000000000000000000000000000000000000: interaction with full protocol:
  • 0x95f03c9db87c84e0b1043857b43822e60143b5fd222cbae6a58608238277e43b: interaction with providers functionality;
  • 0xdb1a8f53c9efd81b585fe5c55b156a15496e6ca1c7d55f21128c594fd4b3157a: interaction with models functionality;
  • 0xe0e347f99bca6ace06441ab53f851efe66ec57205ae2812242ccddb7923a8a79: interaction with marketplace functionality;
  • 0xbb0b3346f3a62a3cf205ec3a488d79de48762f0ab35cbf72aaf290fde72d79f5: interaction with sessions functionality.