Close a Levra position without Levra
Your collateral and your debt sit in your own position on Morpho, under your own address. Levra's contracts hold no user funds between transactions. You can manage or close the position straight on Morpho, from any wallet that can call a contract, for example the "Write contract" tab of the block explorer.
This page has no script and loads nothing else. Not audited. The limits are initial proposals.
Monad
Morpho: 0xD5D960E8C380B724a48AC59E2DfF1b2CB4a1eAee
USDC: 0x754704Bc059F8C67012fEd69BC8A327a5aafb603
Levra routers: 0xf5585feA7aeDC5e148201052f73139111810aA88, 0xa3F19ac30Be34028D9a0CaAcaF00c0b7295Fc2E6
- Revoke Levra's access. On Morpho, call
setAuthorization(router, false)for each router above. Check it withisAuthorized(yourAddress, router). - Remove a USDC allowance. On USDC, call
approve(router, 0)for each router you approved. - Close on Morpho.
- Read your market's parameters with
idToMarketParams(marketId)and your position withposition(marketId, yourAddress)on Morpho. - On the token you owe (USDC for a long, the stock for a short), call
approve(Morpho, amount)for a little more than your debt. - Call
repay(marketParams, 0, borrowShares, yourAddress, 0x)with theborrowSharesfrom step a. Repaying by shares clears the whole debt, so no dust is left behind. - Call
withdrawCollateral(marketParams, collateral, yourAddress, yourAddress)with thecollateralfrom step a. A long gets the stock back; a short gets USDC back.
- Read your market's parameters with
Market IDs on Monad
| Market | Morpho market ID |
|---|---|
| QQQ long | 0xc391a3c7e7c7df45992777417850bf69212762549a251e192a5b9dcf2e607512 |
| HOOD long | 0xccd3e44829842941d7074237a999b318d999c29cb770ed4d067259a52c2f3edd |
| BIL long | 0xcf2268fd4347fe5f5c3278d1a17e8ebd1995de0eaae3ac7bd71afbbaad6a1415 |
| QQQ short | 0xc54a4e80aecb068c56d9e79a770d68140dcad9747132af34f086f4ff907c3262 |
| HOOD short | 0x53ce3f8e5560d6f80e9a219b35a9cd54472f89f75c8c970bc504a6c21391e033 |
| QQQ long | 0xfd08be34271e6c478d490dbdf3c3a63e9f7fd251628ae37981ac7afbab6ddb44 |
| NVDA long | 0xa5ed58c4e5b046883c75f6b1801ecb0eea357822dc96c431f8db89b9bfd1aa4b |
| SPY long | 0x715cdd7a634ba0511631dd4c9113856b45b598f1db26cb32010effff13d01d62 |
| TSLA long | 0x932d94f6e4ac8321c0c7b0fff9c66b97417100db1f6178d7a4789744147bc52d |
| QQQ short | 0x5ea555a7828ae7be3ad90cff0b7920e3be49a26daeeaca12a33c201695d827bc |
| NVDA short | 0x4160560bb0017ec758c31fc2161c47665fcfc6e9cb05daa47ca09f373dd78238 |
| SPY short | 0x944be485b14ec493ec93ebd934567639feeb1799c263f452f1a2278a85a8566f |
| TSLA short | 0x99618eb8eaa4ddee177e602d2df0a7e328c88dfe7999bccac5eb09c9fd798257 |
X Layer
Morpho: 0xeb00C490E888286357dC5B0a35D37D9260D11Ab5
USDC: 0xB6CEceAB302E2E4948951eE7843FC24E92933061
Levra router: 0xf5585feA7aeDC5e148201052f73139111810aA88
- Revoke Levra's access. On Morpho, call
setAuthorization(router, false)for each router above. Check it withisAuthorized(yourAddress, router). - Remove a USDC allowance. On USDC, call
approve(router, 0)for each router you approved. - Close on Morpho.
- Read your market's parameters with
idToMarketParams(marketId)and your position withposition(marketId, yourAddress)on Morpho. - On the token you owe (USDC for a long, the stock for a short), call
approve(Morpho, amount)for a little more than your debt. - Call
repay(marketParams, 0, borrowShares, yourAddress, 0x)with theborrowSharesfrom step a. Repaying by shares clears the whole debt, so no dust is left behind. - Call
withdrawCollateral(marketParams, collateral, yourAddress, yourAddress)with thecollateralfrom step a. A long gets the stock back; a short gets USDC back.
- Read your market's parameters with
Market IDs on X Layer
| Market | Morpho market ID |
|---|---|
| GOOGL long | 0x5f8fcdef7968590c7058067757d18d99bb7e143d86fbb3a6f44d1e47cc470cd3 |
| NVDA long | 0x198bc6185b1da4e17abc2eba61a01d60c07959cb9a31ac5ce6dc6985835871d9 |
| QQQ long | 0x5c544c155f3c2ca375b8cb80faecb05f5b0e7a59654302fec365c5ab230d649f |
| SPY long | 0x2b3aa5ead3faedc052f997864164a95f2c129ae5ac3b848bfc36b5b77a3c4206 |
| GOOGL short | 0x6efe0004b4ca99b217c9bc9f762cf100b218329986badb9b3d98c53cdcdb0100 |
| NVDA short | 0x34879d26e0cb222ee47260d4a8046bdf983b09bbb4077abba127451d9d364f85 |
| QQQ short | 0x831dc8cdce8fd98f567a5e397830a8b89847a7a9d9cf7603e475c2177a2e5413 |
| SPY short | 0xa403cfaa81f30eae48fd68c6bd2705ecd3c5b0da892e343a48bf3e710ad94282 |
Base
Morpho: 0xBBBBBbbBBb9cC5e90e3b3Af64bdAF62C37EEFFCb
USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Levra router: 0xf5585feA7aeDC5e148201052f73139111810aA88
- Revoke Levra's access. On Morpho, call
setAuthorization(router, false)for each router above. Check it withisAuthorized(yourAddress, router). - Remove a USDC allowance. On USDC, call
approve(router, 0)for each router you approved. - Close on Morpho.
- Read your market's parameters with
idToMarketParams(marketId)and your position withposition(marketId, yourAddress)on Morpho. - On the token you owe (USDC for a long, the stock for a short), call
approve(Morpho, amount)for a little more than your debt. - Call
repay(marketParams, 0, borrowShares, yourAddress, 0x)with theborrowSharesfrom step a. Repaying by shares clears the whole debt, so no dust is left behind. - Call
withdrawCollateral(marketParams, collateral, yourAddress, yourAddress)with thecollateralfrom step a. A long gets the stock back; a short gets USDC back.
- Read your market's parameters with
Market IDs on Base
| Market | Morpho market ID |
|---|---|
| AAPL long | 0x7934723c6cc42d5f2bd3c58af4fc14bf0b5ae38245638adabf2052032967b398 |
| AMZN long | 0x23c5324881859a2163ff984d67449fa0f1c0e12f3c52a4dbbbfb4b3313c3f38c |
| GOOGL long | 0x45059d2328299056d05545d0368c8b0d34397047820a0d46b7775275375c76b2 |
| META long | 0x6cf665db25bb5a59615cceffed97e527cfe0183f08176c568fc9c939f91b6647 |
| MSFT long | 0xba887b01160863891d76a273f5dbab6efc6dbe3df5a732ee112313da5aba7ff7 |
| NVDA long | 0x34b62b714803c0121c14ce767b8de3a1d87460f41c662b927dd2bc1527316876 |
| SPCX long | 0xc22d1bc9f71832e1f83eedbecdb45980381176f8889f7b697c2bf6de6223c242 |
| TSLA long | 0xd62e941889f385ac51cc825c72a2ea04e7c8e02ceb68c141d0b0a7d17fbf01c9 |
| AAPL short | 0x8fed1ed63e26d4997525ab68f67a58878eb481b711ebf0f560054885a25226e6 |
| AMZN short | 0xf6d5949b6bea4691073b7ce82d431f73a73bc6fdd98499e79e8e8e12441b4175 |
| GOOGL short | 0x5aa5136108ae13ef4ebbc91faada6ae1ad47d07c9c8d77290e76c388446253a9 |
| META short | 0x11a4175314b1b174363dbdea13b6f2bc8277c947953b7a4cf01eb32a984126dd |
| MSFT short | 0x5f57cf8280964dc2a851e5c8d6da850227b9aec1f1791292fc024bbb6646bda8 |
| NVDA short | 0x869c760367a10b076bc0206b63d003cc519f994b14d6aad61b976ac15a52e080 |
| SPCX short | 0x0ae42283dd827b92d084ef5b64a7fe8e145b5216718b17c6addd36fbf5c6e581 |
| TSLA short | 0x8430223a3d5943137fd3924fedbb90d3c2e250270f07bceaebce1a427e792b0d |