

Introduction
Wrapped Smart Contracts (WSC) have recently been integrated into the Milkomeda platform and Blueshift DEX. This integration changes how Cardano wallet users engage with the wider blockchain world. It establishes a smooth connection between Cardano's Layer 1 blockchain and Milkomeda's Layer 2 solution, enabling users to easily use Ethereum Virtual Machine (EVM) compatible decentralized applications (DApps). In this article, we explore the importance of Wrapped Smart Contracts and how they improve the Cardano experience for users.
The Need for Wrapped Smart Contracts
Before the introduction of Wrapped Smart Contracts (WSC), transferring assets between Layer 1 blockchains like Cardano and Layer 2 solutions like Milkomeda was a complex and convoluted process. This involved wrapping or bridging assets, managing multiple wallets, and navigating various cumbersome steps.
Wrapped Smart Contracts have elegantly resolved these issues by streamlining the user journey between Layer 1 and Layer 2 chains, offering a simplified and unified experience.
How Wrapped Smart Contracts Work
When using WSC, a smart contract (actor) is deployed on Milkomeda's Layer 2, bound to the user's specific Layer 1 address. This smart contract serves as an account abstraction, possessing a balance, a nonce, and the ability to execute signed transactions on behalf of the user.
Users can connect to DApps that support WSC using their Cardano wallets, which will generate an EVM address for them. Unlike an Externally Owned Account (EOA), this address doesn't require users to manage private keys. Instead, users can create transactions on Layer 2 and sign them using their Layer 1 account.
This eliminates the need for manual asset bridging to Milkomeda from Cardano or the use of Ethereum-based wallets to interact with DApps on Milkomeda.
User-Friendly Guide to Using EVM dApps with Wrapped Smart Contracts
Discover how to use EVM dApps with Wrapped Smart Contracts (WSC) for a simplified experience in buying and selling ReserveCoin from the Djed Protocol on Milkomeda's Layer.
Step 1: Start EVM dApp Interaction
- Open your web browser or app and go to the EVM dApp.
- Make sure you're connected to the main blockchain network.
Step 2: Explore and Choose
- Inside the EVM dApp, you'll see different things you can do.
- Pick what you want, like buying an in-game item or doing a DeFi transaction.
Step 3: Confirm Your Action
- When you choose an action, the EVM dApp will ask you to say "yes" to confirm.
- This ensures you know what you're doing and what it will cost you (like gas fees).
Step 4: Smart Contract Magic
- Once you confirm, the EVM dApp will use a special smart contract called the "Proxy" on the sidechain.
- This contract shows you want to do your chosen action.
Step 5: Action on the Sidechain
- The Proxy smart contract talks to another smart contract on the sidechain to do your action.
- The sidechain is faster and cheaper than the main blockchain.
Step 6: Know the Result
- After the sidechain finishes your action, the EVM dApp will tell you what happened.
- You'll get a message to say if your action worked.
Step 7: See the Change
- Your account on the main blockchain updates immediately based on what happened on the sidechain.
- For example, if you bought an in-game item, you'll see it in your inventory.
Step 8: Stay on Track
- You won't leave the main blockchain during all of this.
- It's a smooth and simple experience without switching to other places or networks.
Step 9: Fee Reminder
- Remember, every action you do on the blockchain costs some money, called gas fees.
- It can change depending on the network's busyness and what you're doing.
- The EVM dApp will show you how much it might cost before you say "yes."
Step 10: Safe and Trustworthy
- The EVM dApp uses smart contracts and strong tech to ensure your actions are safe and work right.
- You can trust it to do things securely.
Go ahead and try EVM dApps with Wrapped Smart Contracts. It's easy fast, and keeps you connected to the main blockchain while you explore exciting new things!
Overview of Wrapped Smart Contracts Architecture
Wrapped Smart Contracts (WSC) protocol enables the execution of Layer 2 smart contracts directly from Layer 1 wallets. This integration is made possible through the provider object, adhering to the EIP-1193 standard, serving as a bridge between the EVM provider and the Layer 1 provider. By leveraging WSC, EVM DApps can seamlessly communicate with Layer 1 wallets and execute transactions on Layer 2 smart contracts.
Architecture
Wrapped Smart Contracts rely on three key components:
Smart Contracts: In Milkomeda C1, users typically have dedicated accounts like wallets such as Flint or Metamask. To simplify this process, a smart contract known as the Actor is utilized as an account abstraction, executing actions on behalf of the user.
Message Relay Oracle: It facilitates communication between Layer 1 and Layer 2 actors. It functions as a node.js JSON-RPC API, offering essential functionalities for deploying the Account Contract (using the ActorFactory) and executing transactions on behalf of users.
Provider: The front-end library injects the provider object, compliant with the EIP-1193 standard, into the window.ethereum object. This customized provider incorporates specific methods like eth_sendTransaction and eth_requestAccounts, designed for interaction with the Layer 1 wallet. These methods transform the results as necessary to ensure a user-friendly experience.
Protocol Flow
Source: Milkomeda Wrapped Smart Contracts
Here's how the full protocol flow works for a user's first interaction, where an Actor proxy smart contract is deployed and linked to the user's L1 address:
- Connect Wallets: The user requests to create an Actor with the tx_data calling the Final SC (Smart Contract) and receives the actor address back. The tx_data is an encoded transaction that the Actor will call on the Final SC. The actor address is derived from the L1 address using the CREATE2 opcode.
- To deploy the Actor with the tx_data calling the Final SC, External calls the ActorFactory.
- The ActorFactory deploys the Actor using CREATE2, based on the description of the deploy function.
- After deployment, the user verifies the correct Actor address and sends funds to it through the Bridge.
- The Bridge wraps them and sends them to the Actor. External listens to the Bridge events; it calls to execute once the funds are wrapped.
- The Actor calls the FinalSC on behalf of the user.
- After execution, The Actor calls the withdraw function, creating a request to the Bridge.
- The Bridge unwraps the funds back to the user.
- Note: Subsequent interactions through Wrapped Smart Contracts will skip steps 2 and 3 since the Actor is already deployed and operational.
- Additionally, it's important to note that the Actor smart contract covers the gas for transactions. To execute any transaction, the Actor must maintain an adequate balance to perform the transaction and handle the associated gas fees.
For further details on wrapped smart contracts, learn here.
Blueshift WSC Launch Campaign
To celebrate the launch of Wrapped Smart Contracts, users are invited to experience interacting with the cross-chain portfolio-based DEX and try swapping and providing liquidity via the Blueshift DEX using their Cardano native wallet, courtesy of the Milkomeda team and the use of Wrapped Smart Contracts.
During this campaign, there will be a boosted Annual Percentage Rate (APR) for the Cardano Index, offering liquidity providers enhanced rewards for participating in the launch of Wrapped Smart Contracts. The Milkomeda team has generously sponsored an additional USD 10,000 worth of rewards in Cardano Index LP Tokens for liquidity providers who move and lock in their liquidity for at least two weeks.
The campaign also includes a lottery for the prize pool, where the amount of liquidity staked to the DEX acts as ticket purchases. Users will receive one lottery ticket for each USD 10 added as liquidity and staked to the Index to the DEX. Each lottery ticket will be allocated to wallet addresses that have successfully provided liquidity for the required 2-week period to the Cardano Index.
There is no limit to the number of tickets a user can obtain. For example, providing USD 1000 liquidity to the Cardano Index will yield 100 raffle tickets.
Liquidity can be provided in various assets that make up the Cardano Index, including Cornicopias ($COPI), NMRK ($NMKR), VyFinance ($VYFI), Blueshift ($BLUES), and ADA itself.
The campaign will commence on September 4th, 2023, at 00:00 UTC and conclude on September 29th, 2023, at 00:00 UTC. An additional 2-week lag after the campaign will allow the final data snapshot to accommodate users providing liquidity at the last moment. This data snapshot will be conducted on October 13th, 2023, at 00:00 UTC.
Distribution of the Rewards
The USD 10,000 rewards will be Cardano Index LP tokens, allowing users to move assets or continue staking their rewards upon distribution. The distribution of rewards will be divided into multiple divisions, ensuring fairness.
For detailed information, read here.
Closing Thoughts
Wrapped Smart Contracts mark a significant milestone for the Milkomeda ecosystem and Blueshift. They enable Cardano users to seamlessly interact with the DEX and other DApps built on Milkomeda without leaving the Cardano environment. This advancement improves usability and opens up more DeFi options for Cardano users.
- Log in or register to post comments