Morpheus AI is a Smart Agent concept of connecting LLMs and AI Agents to wallets, Dapps, & smart contracts promises to open the world of Web3 to everyone. Chatting in normal language with your Smart Agent and having it understand the question or task, is similar to how Google's search engine opened the early internet up to the general public.
Morpheus AI is a Smart Agent concept of connecting LLMs and AI Agents to wallets, Dapps, & smart contracts promises to open the world of Web3 to everyone. Chatting in normal language with your Smart Agent and having it understand the question or task, is similar to how Google's search engine opened the early internet up to the general public.
The project is launching using the Techno Capital Machine (TCM) model inspired by https://twitter.com/BasedBeffJezos and outlined here - https://github.com/MorpheusAIs/Morpheus/blob/1b8abd0694940acc10a0b70611148d6e893ba017/!KEYDOCS%20README%20FIRST!/4.TechnoCapitalMachineTCM.md#L4
The contract audit will cover the initial phases of the TCM development.
Users direct yield toward the open source project of their choice by depositing assets such as stETH into a Smart Contract. 50% of the daily yield purchases tokens in the open source project, which are contributed to an AMM trading pair as Protocol Owned Liquidity. 50% of the daily yield remains as stETH and is added to an AMM as the other half of the trading pair as Protocol Owned Liquidity. The open source project emits its native token to the contributor of the yield on a daily basis.
Later development of the project will ensure holders of the native tokens have access to the open source project’s utility.
Capital Provider
Code Provider
All items within the below directory mocks can be considered in-scope https://github.com/Cyfrin/2024-01-Morpheus
├── contracts
│ ├── Distribution.sol
│ ├── L1Sender.sol
│ ├── L2MessageReceiver.sol
│ ├── L2TokenReceiver.sol
│ ├── MOR.sol
│ ├── interfaces
│ │ ├── IDistribution.sol
│ │ ├── IL1Sender.sol
│ │ ├── IL2MessageReceiver.sol
│ │ ├── IL2TokenReceiver.sol
│ │ ├── IMOR.sol
│ │ ├── tokens
│ │ │ ├── IStETH.sol
│ │ │ └── IWStETH.sol
│ │ └── uniswap-v3
│ │ └── INonfungiblePositionManager.sol
│ ├── libs
│ │ └── LinearDistributionIntervalDecrease.sol
│ └── mock
│ ├── DistributionV2.sol
│ ├── GatewayRouterMock.sol
│ ├── L1SenderV2.sol
│ ├── L2MessageReceiverV2.sol
│ ├── L2TokenReceiverV2.sol
│ ├── NonfungiblePositionManagerMock.sol
│ ├── SwapRouterMock.sol
│ └── tokens
│ ├── StETHMock.sol
│ └── WStETHMock.sol
The contract is EVM compatible, works with Arbitrum and integrates to Uniswap AMM.
Compatibiilities:
git clone https://github.com/Cyfrin/2024-01-Morpheus.git
cd 2024-01-Morpheus
To install the dependencies, run the following command:
npm install
To compile the contracts, use the next script:
npm run compile
To run the tests, execute the following command:
npm run test
To run the tests for forked mainnet, run:
npm run test-fork
You need to set the
INFURA_KEY
environment variable to run the tests for forked mainnet.
Or to see the coverage, run:
npm run coverage
You need to set the
INFURA_KEY
environment variable to run the coverage.
Before deploying, you need to create an .env
file following the example of .env.example
.
Next, you need to fill out config file deploy/data/config.json
(yoy may choose another file name, based on the network). The example of the config file is already provided. Make sure to fill out all the fields, specifically the payoutStart
field.
Next, call script located in deploy/deploy-all.sh
with the following arguments:
./deploy/deploy-all.sh <L1 network> <L2 network>
Where the first argument is the L1 network name and the second argument is the L2 network name.
(network is the name of the network, which should be in hardhat.config.js
)
To deploy the contracts locally, run the following commands (in the different terminals):
npm run private-network
./deploy/deploy-all.sh localhost localhost
The local deployment is may fail due to the lack of third-party contracts. To fix this, you may run test deployment on the forked mainnet.
The command to generate the bindings is as follows:
npm run generate-types
See the full list of available commands in the
package.json
file.
Users interacting with the MorpheusAI Smart Contracts must be aware of the privileged roles in the protocol and which actions these privileged roles can perform. Distribution.sol is the contract that will hold the user's staked funds i.e. a token such as stETH. Currently, there are mechanisms, controlled only by the owner of the contract, that can cause indefinite custody of the user's deposited tokens. In other words, users would never be able to withdraw their staked funds again. The owner role must be fully trusted.
The alias of L1Sender.sol on Arbitrum will hold the ETH received as a gas refund from bridging tokens Context: L1Sender.sol, L2TokenReceiver.sol
Community Approach - Deploy a contract that can rescue the ETH on the L2 alias address of L1Sender. Or oth- erwise, accept that any excess ETH sent is lost and protect L1Sender.sendDepositToken() with a check that _msgSender() == distribution.
The Distribution._withdraw() function pays out deposits on a first-come-first-serve basis. This means if there occurs a slashing of staked ETH in Lido (negative rebasing), the stETH balance in Distribution is insufficient to serve all users. The Distribution contract accounts for this scenario by limiting the amount that can be withdrawn to the contract's balance: This may cause a "bank-run" where users want to withdraw their stETH as long as there is any left. Once this "bank-run" is over, there may be a pool deposits balance greater zero and a stETH balance equal to zero. When new depositors come in, they could lose their funds to existing depositors that withdraw. Recommendation: According to Lido docs, rebases have never been negative thus far. Tracking stETH deposits directly seems to be a deliberate decision by the Morpheus team. As such the issue is simply a reminder for users interacting with the Morpheus smart contracts and the finding can be acknowledged.
Adjusted for a small lag in the system.
UUPSUpgradeable contracts will implement a constructor with a call to Initializ- able.disableInitializers Context: Distribution.sol, L1Sender.sol, L2TokenReceiver, L2MessageReceiver.sol
Minimum - 1/3 yield - How far you take it out.
Additional Known Issues as detected by static Analysis: https://github.com/Cyfrin/2024-01-Morpheus/issues/1
Rank | Username | |||||
1 | t turvyfuzz | $2664.89 | 280 | 1 (0) | 0 (0) | 0 |
2 | S SovaSlava | $2530.16 | 240 | 1 (0) | 1 (0) | 0 |
3 | 0 0xhals | $2068.80 | 208 | 1 (0) | 0 (0) | 2 |
4 | M MrPotatoMagic | $1952.28 | 212 | 1 (0) | 0 (0) | 3 |
5 | i iamandreiski | $1908.09 | 204 | 1 (0) | 0 (0) | 1 |
6 | n nmirchev8 | $1903.49 | 200 | 1 (0) | 0 (0) | 0 |
7 | 0 0xG0P1 | $1903.49 | 200 | 1 (0) | 0 (0) | 0 |
8 | D DenTonylifer | $1903.49 | 200 | 1 (0) | 0 (0) | 0 |
9 | 0 | $976.58 | 64 | 0 (0) | 1 (0) | 2 |
10 | D Denzi | $652.29 | 54 | 0 (0) | 1 (0) | 3 |
11 | p | $644.32 | 15 | 0 (0) | 0 (0) | 3 |
12 | m matej | $629.49 | 44 | 0 (0) | 1 (0) | 1 |
13 | P PratRed | $629.49 | 44 | 0 (0) | 1 (0) | 1 |
14 | x | $626.66 | 40 | 0 (0) | 1 (0) | 0 |
15 | T Timenov | $499.99 | 6 | 0 (0) | 0 (0) | 1 |
16 | K Krace | $234.33 | 10 | 0 (0) | 0 (0) | 2 |
17 | g greatlake | $125.19 | 16 | 0 (0) | 0 (0) | 4 |
18 | o oualidpro | $79.80 | 22 | 0 (0) | 0 (0) | 5 |
19 | 0 | $77.19 | 15 | 0 (0) | 0 (0) | 3 |
20 | a abhishekthakur | $44.20 | 8 | 0 (0) | 0 (0) | 2 |
21 | k kaysoft | $44.20 | 8 | 0 (0) | 0 (0) | 2 |
22 | J Joshuajee | $44.20 | 8 | 0 (0) | 0 (0) | 2 |
23 | 0 | $44.20 | 8 | 0 (0) | 0 (0) | 2 |
24 | c chainNue | $35.29 | 12 | 0 (0) | 0 (0) | 3 |
25 | s smbv1923 | $24.17 | 8 | 0 (0) | 0 (0) | 2 |
26 | A Auditism | $24.17 | 8 | 0 (0) | 0 (0) | 2 |
27 | N Night | $21.35 | 4 | 0 (0) | 0 (0) | 1 |
28 | H Heba | $21.35 | 4 | 0 (0) | 0 (0) | 1 |
29 | 0 0xLuckyLuke | $17.08 | 4 | 0 (0) | 0 (0) | 1 |
30 | z zigtur | $17.08 | 4 | 0 (0) | 0 (0) | 1 |
31 | 1 1nc0gn170 | $13.94 | 8 | 0 (0) | 0 (0) | 2 |
32 | s serialcoder | $13.08 | 6 | 0 (0) | 0 (0) | 1 |
33 | I IvanFitro | $9.34 | 4 | 0 (0) | 0 (0) | 1 |
34 | T Tripathi | $9.34 | 4 | 0 (0) | 0 (0) | 1 |
35 | y | $9.34 | 4 | 0 (0) | 0 (0) | 1 |
36 | S Silvermist | $9.34 | 4 | 0 (0) | 0 (0) | 1 |
37 | V VaRuN | $9.34 | 4 | 0 (0) | 0 (0) | 1 |
38 | C C1rdan | $9.34 | 4 | 0 (0) | 0 (0) | 1 |
39 | 0 0xDemon | $6.43 | 6 | 0 (0) | 0 (0) | 1 |
40 | I | $4.60 | 4 | 0 (0) | 0 (0) | 1 |
41 | 0 0xRizwan | $4.60 | 4 | 0 (0) | 0 (0) | 1 |
42 | c crypticdefense | $4.60 | 4 | 0 (0) | 0 (0) | 1 |
43 | S SanketKogekar | $4.60 | 4 | 0 (0) | 0 (0) | 1 |
44 | m m4k2 | $4.60 | 4 | 0 (0) | 0 (0) | 1 |
45 | Z ZanyBonzy | $4.60 | 4 | 0 (0) | 0 (0) | 1 |
46 | l lileth | $4.60 | 4 | 0 (0) | 0 (0) | 1 |
47 | 0 0xepley | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
48 | T | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
49 | 9 | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
50 | P Pelz | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
51 | 0 0xWallSecurity | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
52 | B | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
53 | S SkyHunter | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
54 | K King | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
55 | k | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
56 | m mgf15 | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
57 | u ubl4nk | $2.82 | 4 | 0 (0) | 0 (0) | 1 |
58 | n nabeel | $0.00 | 4 | 0 (0) | 0 (0) | 0 |
59 | l lowkey | $0.00 | 4 | 0 (0) | 0 (0) | 0 |