Git Product home page Git Product logo

scroll-contract-deploy-demo's Introduction

Project moved to the scroll-guides repo.


Scroll Contract Deployment Demo

This project demonstrates how to use hardhat or foundry to deploy a contract in Scroll's rollup network. This project contains a simple contract that will lock a certain amount of Ether in the deployed contract for a specified amount of time.

Prerequisites

Deploy with Hardhat

  1. If you haven't already, install nodejs and yarn.
  2. Run yarn install to install dependencies.
  3. Create a .env file following the example .env.example in the root directory. Change PRIVATE_KEY to your own account private key in the .env.
  4. Run yarn compile to compile the contract.
  5. Run yarn deploy:scrollTestnet to deploy the contract on the Scroll Alpha Testnet.
  6. Run yarn test for hardhat tests.

Deploy with Foundry

  1. Install Foundry.
    curl -L https://foundry.paradigm.xyz | bash
    foundryup
  2. Build the project.
    forge build
    
  3. Deploy the contract.
    forge create --rpc-url https://alpha-rpc.scroll.io/l2 \
      --value <lock_amount> \
      --constructor-args <unlock_time> \
      --private-key <your_private_key> \
      --legacy \
      contracts/Lock.sol:Lock
    
  • <lock_amount> is the amount of ETH to be locked in the contract. Try setting this to some small amount, like 0.0000001ether.
  • <unlock_time> is the Unix timestamp after which the funds locked in the contract will become available for withdrawal. Try setting this to some Unix timestamp in the future, like 1696118400 (this Unix timestamp corresponds to October 1, 2023).

For example:

forge create --rpc-url https://alpha-rpc.scroll.io/l2 \
  --value 0.00000000002ether \
  --constructor-args 1696118400 \
  --private-key 0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1 \
  --legacy \
  contracts/Lock.sol:Lock

Support

Join our Discord: https://scroll.io/

scroll-contract-deploy-demo's People

Contributors

andyrdt avatar dghelm avatar icemelon avatar orestta avatar pajicf avatar thegaram avatar zimpha avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scroll-contract-deploy-demo's Issues

Scroll

I'm a scroll contributor.

why 30 member for bridge

if any one interest in crypto and has come this far; ฤฑ think you shouldn't care about tweeter followers number:)

Invalid RPC URL

hi deploying testnet at scroll having issues - at step (C:\Users\Swapnil Bhadade\Downloads\scroll-app\scroll-guides\contract-deploy-demo\node_modules@ethersproject\providers\lib\json-rpc-provider.js:48:23) {
code: 'ERR_INVALID_URL',
input: ''
}
@vyzo
this command is failing - yarn deploy:scrollTestnet

Fast

It's need to be faster and efficient.

Fallback function - contracts/Lock.sol

Probably should consider adding a fallback function, thus rejecting any eth sent directly to the contract:

receive() external payable {
revert("This contract does not accept Ether directly");
}

deploying contract on scroll

A "Scroll Contract Deploy Demo" could be a demonstration or example showcasing how to deploy a smart contract on the Scroll network. Here's a simplified step-by-step outline of what such a demo might entail:

Prerequisites: Ensure that you have access to the Scroll network and the necessary tools for smart contract development and deployment.

Smart Contract Development: Write a simple smart contract using a programming language compatible with the Scroll network, such as Solidity. This contract could implement basic functionality like token transfers, voting, or decentralized finance operations.

Compile the Smart Contract: Use a Solidity compiler or development environment to compile the smart contract code into bytecode.

Deployment Script: Write a deployment script or utilize a deployment tool provided by Scroll to deploy the compiled smart contract bytecode onto the Scroll network. This script will typically include instructions for connecting to the Scroll network, specifying deployment parameters, and sending the transaction to deploy the contract.

Execute Deployment: Run the deployment script, which will interact with the Scroll network to deploy the smart contract. This process involves creating a transaction on the Scroll network, which includes deploying the bytecode to a specific address.

Verify Deployment: After the deployment transaction is confirmed on the Scroll network, verify that the smart contract has been successfully deployed by checking its address and confirming its presence on the blockchain.

Interact with the Contract: Optionally, demonstrate how to interact with the deployed smart contract by calling its functions or sending transactions to it. This step showcases the functionality provided by the smart contract and how users can interact with it on the Scroll network.

Conclusion: Conclude the demo by summarizing the key steps involved in deploying a smart contract on the Scroll network and highlighting the benefits of using Scroll for scalable and efficient contract deployment and execution.

By following these steps, a "Scroll Contract Deploy Demo" can provide users with a practical example of how to deploy smart contracts on the Scroll network and leverage its capabilities for decentralized application development.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.