Skip to content

veyrix-Tr/Ether-vault

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EtherVault

EtherVault is a secure and gas-efficient Ethereum smart contract built with Solidity, designed for handling ETH deposits and withdrawals. It features robust control mechanisms like cooldowns, pausability, and an emergency withdrawal mode to protect both users and contract owners.


✅ Features

  • Users can securely deposit ETH above a dynamically set minimum (based on Chainlink oracle price).
  • Withdrawals are only allowed after a cooldown period.
  • Owner can pause the contract in emergencies.
  • Emergency withdrawal mechanism for the owner after a set timeout.
  • Fully tested with Forge (Foundry) for deposit, withdrawal, edge cases, and access control.
  • Modular deployment and interaction scripts.
  • Oracle integration with support for mainnet, Sepolia, and local mock price feeds.

Foundry License: MIT Tests Coverage


🧰 Tech Stack

  • Solidity ^0.8.18
  • Foundry (Forge, Cast, Anvil)
  • Chainlink Oracles
  • MockV3Aggregator for local testing
  • Forge Cheatcodes for user simulation and time manipulation

📂 Project Structure

├── src/ 
|     ├── EtherVault.sol
|     └── PriceConverter.sol
├── script/ 
|     ├── DeployEtherVault.s.sol
|     ├── HelperConfig.s.sol
|     └── Interact.s.sol
├── test/ 
|     ├── mocks
|     |     └── MockV3Aggregator.sol
|     └──TestEtherVault.t.sol
├── lib/
└── foundry.toml

🛠️ Installation

Requires Foundry

Install Foundry (if not already installed)

curl -L https://foundry.paradigm.xyz | bash
foundryup

📁 Clone the Repo

git clone https://github.com/your-username/ethervault.git
cd ethervault
forge install

⚙️ Compile the Contracts

forge build

🧪 Run Tests

forge test -vv

-vv gives detailed logs for easier debugging.


🚀 Deploy to Local Network (Anvil)

Start Anvil (local blockchain):

anvil

Deploy the contract:

forge script script/DeployEtherVault.s.sol:DeployEtherVault --fork-url http://localhost:8545 --broadcast

🔗 Deploy to Sepolia (or other testnets)

Set up environment variables:

export SEPOLIA_RPC_URL=your_rpc_url
export PRIVATE_KEY=your_private_key

Then deploy:

forge script script/DeployEtherVault.s.sol:DeployEtherVault --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --broadcast

💬 Interact with the Contract

forge script script/Interact.s.sol:Interact --rpc-url $SEPOLIA_RPC_URL --private-key $PRIVATE_KEY --broadcast

Or for local testing:

forge script script/Interact.s.sol:Interact --fork-url http://localhost:8545 --broadcast

🧹 Clean Build Artifacts

forge clean

👨‍💻 Author

Chirag Goyal
B.Tech, Chemical Engineering, IIT Roorkee
Blockchain & Software Developer | Builder | Learner


📬 Feedback & Contributions

Feel free to raise an issue or contribute improvements to this project. All contributions are welcome.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published