{"id":21519133,"url":"https://github.com/dcspark/wrapped-smartcontracts","last_synced_at":"2026-03-11T12:51:55.275Z","repository":{"id":177163801,"uuid":"652434502","full_name":"dcSpark/wrapped-smartcontracts","owner":"dcSpark","description":null,"archived":false,"fork":false,"pushed_at":"2024-01-24T01:36:54.000Z","size":3957,"stargazers_count":2,"open_issues_count":6,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-10-21T21:56:13.699Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dcSpark.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-06-12T04:26:06.000Z","updated_at":"2023-09-03T09:15:24.000Z","dependencies_parsed_at":"2025-04-09T22:18:36.406Z","dependency_job_id":null,"html_url":"https://github.com/dcSpark/wrapped-smartcontracts","commit_stats":null,"previous_names":["dcspark/wrapped-smartcontracts"],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/dcSpark/wrapped-smartcontracts","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fwrapped-smartcontracts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fwrapped-smartcontracts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fwrapped-smartcontracts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fwrapped-smartcontracts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dcSpark","download_url":"https://codeload.github.com/dcSpark/wrapped-smartcontracts/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dcSpark%2Fwrapped-smartcontracts/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30381798,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T12:49:11.341Z","status":"ssl_error","status_checked_at":"2026-03-11T12:46:41.342Z","response_time":84,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-24T00:55:57.116Z","updated_at":"2026-03-11T12:51:55.238Z","avatar_url":"https://github.com/dcSpark.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Milkomeda Wrapped Smart Contracts\n\n## Table of Contents\n\n- [Overview](#overview)\n- [For developers](#for-developers)\n- [Smart contracts](#smart-contracts)\n  - [Actor](#actor)\n  - [ActorFactory](#actorfactory)\n  - [L1MsgVerify](#l1msgverify)\n    - [CardanoSigVerification](#cardanosigverification)\n- [Oracle](#oracle)\n- [Provider](#provider)\n- [Flow](#flow)\n- [Setup](#setup)\n- [Tests](#tests)\n- [Example dapp](#example-dapp)\n\n## Overview\n\nWrapped Smart Contracts (WSC) are a new concept aimed at facilitating interaction with smart contracts on sidechains or Layer 2 (L2) solutions without the need for users to directly migrate to these new ecosystems.\n\nThe Layer 1 (L1) blockchain acts as a robust coordination layer, allowing users to execute smart contracts on sidechains or L2 while remaining on the L1 blockchain. This provides a user-friendly experience, as users can interact with various systems without changing wallets or needing a deep understanding of the underlying processes.\n\n### How it works (simplified)\n\nEvery single step requires user interaction in the form of a transaction.\n\n- User Action: The user initiates an action on a dApp while on the main blockchain. This request is translated into specific parameters for a proxy smart contract.\n- Proxy Deployment and Execution: A proxy smart contract, reflecting the user's intent, is deployed on the sidechain. The proxy contract then interacts with the appropriate smart contract on the sidechain to execute the desired action.\n- Result Processing: The outcome from the sidechain smart contract execution is relayed back to the user on the main blockchain. The user's state is updated, and they see the results of their action on the dApp, all while staying on the main blockchain.\n\n## For developers\n\nIf you are interested in developing dapps on the milkomeda layer 2, see the [developers documentation](./docs/developers.md). Also, there is a library under `packages/milkomeda-wsc` that help the development of DApp using WSC. It's also available in [npm](https://www.npmjs.com/package/milkomeda-wsc).\n\n## Smart contracts\n\nThe role of the Metamask wallet on the milkomeda is for the user to have dedicated account. To get around this the smart contract `Actor` will be used as an account abstraction that will be acting on behalf of the user.\n\n### Actor\n\nActor is a smart contract deployed on the milkomeda layer 2 that is bound to the specific l1 address. It serves as an account abstraction, it has a balance, a nonce, and can execute signed transactions on behalf of the user. To verify the signature the actor will use the `L1MsgVerify` precompiled contract that can verify l1 signatures. The execution will be invoked by oracle service, which will get exact refund for the gas paid during the execution.\n\nIn the [compile task](./packages/contracts/tasks/compile.ts) the `Actor` contract is compiled to the yul code and prepended with the code to store the transaction gas limit to the storage. The gas limit is crucial to the calculation of used gas and to verify that the oracle acted honestly and didn't provide less gas than user signed and therefore the transaction would run out of gas. The yul code is later compiled to the evm bytecode and edited in the artifacts.\n\n### ActorFactory\n\nActorFactory is a smart contract deployed on the milkomeda layer 2 that is used to deploy actors. It uses CREATE2 opcode to deterministically derive Actor address from the l1 address.\n\n### L1MsgVerify\n\nL1MsgVerify is a precompiled contract that is used to verify the signature of the message signed on the layer 1 mainchain.\n\n#### CardanoSigVerification\n\nCardanoSigVerification is a precompiled contract that is deprecated, but needed for backwards compatibility with the milkomeda-c1 testnet.\n\n## Oracle\n\nOracle is a node.js JSON-RPC api that relays messages from l1 to the l2 actors. It provides methods for interacting with the ActorFactory and to execute transactions on behalf of the user.\n\n## Provider\n\nProvider is a front end library which injects the provider based on EIP-1193 object to the `window.ethereum` object. Provider customizes certain methods like `eth_sendTransaction` or `eth_requestAccounts` by invoking l1 wallet and transforming the result.\n\n## Flow\n\nThe exemplary flow of the protocol is as follows:\n\n1. The dapp injects the provider.\n2. The dapp calls `eth_requestAccounts` to get the user's l2 address.\n3. The provider calls `eth_sendTransaction` to execute any transaction.\n4. The transactions gets to the oracle from provider.\n5. The oracle prevalidates the transaction and executes it on the actor.\n6. The oracle gets refund for the paid gas.\n7. Any uncustomized methods the provider passes to the regular provider node.\n\n## Setup\n\nYou need to have installed `node` and `npm`.\n\nTo install dependencies run:\n\n```bash\nnpm run prepare-artifacts\nnpm install\n```\n\n## Tests\n\nTo run tests you need to have installed [dcSpark/besu](https://github.com/dcSpark/besu) or docker.\n\nRun the testing network:\n\n```bash\nnpm run chain:start\n```\n\nTo stop the testing network:\n\n```bash\nnpm run chain:stop\n```\n\nTo run tests:\n\n```bash\nnpm test\n```\n\n## Example dapp\n\nTo run the example dapp you need to have running chain and oracle.\n\nTo run the chain and oracle:\n\n```bash\nnpm run chain:start\nnpm run oracle:dev\n```\n\nTo run the dapp:\n\n```bash\nnpm start -w packages/dapp-example\n```\n\nDapp is running on [localhost:3000](http://localhost:3000).\n\n## Licensing\n\nThe primary license for Wrapped Smart-Contracts is the Starting Gate Public License 1.0 (SGPL-1.0), see [LICENSE](./LICENSE.md). If you are a building with educational or even commercial purposes on Milkomeda C1 or A1, the entire repo is considered under MIT. The License applies to usages outside Milkomeda. However, some packages are licensed under a MIT License even outside Milkomeda: `actor-webpage`, `milkomeda-wsc` and `dapp-example`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcspark%2Fwrapped-smartcontracts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdcspark%2Fwrapped-smartcontracts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdcspark%2Fwrapped-smartcontracts/lists"}