Giter VIP home page Giter VIP logo

escrow-smart-contract's Introduction

Escrow Smart Contract

This repository contains a Solidity smart contract for a simple escrow system, along with tests and deployment scripts using the Foundry framework.

Overview

The Escrow contract facilitates a secure transaction between a buyer and a seller, with additional roles for an inspector and a lender. It manages the state of the transaction through various stages, from awaiting payment to completion.

Contract Features

  • Manages four parties: buyer, seller, inspector, and lender
  • Implements a state machine for the escrow process
  • Allows for deposit, inspection confirmation, sale approval, and cancellation
  • Includes access control to ensure only authorized parties can perform specific actions

Smart Contract

The main contract is Escrow.sol, which includes the following key functions:

  • deposit(): Allows the buyer to deposit funds
  • confirmInspection(): Allows the inspector to confirm or reject the inspection
  • approveSale(): Allows the buyer to approve the sale and release funds to the seller
  • cancelSale(): Allows the buyer to cancel the sale and retrieve the deposited funds

Getting Started:

Installation and Deployment

  1. Clone the repository:

    git clone https://github.com/mishraji874/Escrow-Smart-Contract.git
  2. Navigate to the project directory:

    cd Escrow-Smart-Contract
  3. Initialize Foundry and Forge:

    forge init
  4. Create the .env file and paste the Alchemy api for the Sepolia Testnet and your Private Key from the Metamask.

  5. Compile and deploy the smart contracts:

    If you want to deploy to the local network anvil then run this command:

    forge script script/DeployEscrow.s.sol --rpc-url {LOCAL_RPC_URL} --private-key {PRIVATE_KEY}

    If you want to deploy to the Sepolia testnet then run this command:

    forge script script/DeployEscrow.s.sol --rpc-url ${SEPOLIA_RPC_URL} --private-key ${PRIVATE_KEY}

Running Tests

Run the automated tests for the smart contract:

forge test

escrow-smart-contract's People

Contributors

mishraji874 avatar

Watchers

 avatar

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.