CombinedEscrow is a Solidity smart contract that facilitates both ETH and ERC20 token escrow services with support for refund mechanisms, withdrawals, and automated destruction after contract use. It integrates OpenZeppelin’s RefundEscrow, ensures secure handling of assets, and provides both ETH and token management within a single contract.
- Active [0x0] - This state accepts deposits of Eth & Erc20
- Closed [0x1] - This state is final - only withdral of erc20
- Refunding [0x2] - This state is final - only withdral of eth back to users
Requires a soft cap or something to compare against to trigger a refund state
- Config [0x0] - This state accepts deposits of Erc20 by onlyOwner - This state is a prepratory state for future eth deposits
- Active [0x1] - This state accepts deposits of Eth by anyone - This state also calls withdrawErc20 to distribute the purchased erc20
- Closed [0x2] - This state is final - onlyOwner can now withdraw unsold erc20 tokens.
- Refunding - This state no longer exists as the Erc20 is distributed with the deposit of eth.
- ETH and ERC20 token escrow support.
- Refund mechanism in case of unmet conditions (e.g., soft cap failure).
- Secure deposit and withdrawal functionalities for both ETH and ERC20 tokens.
- Implements
burnAfterReading()to self-destruct after successful withdrawal. - Integrated with OpenZeppelin's
ReentrancyGuardfor added security. - Suitable for token sales, crowdfunding, and similar use cases.
- deposit & withdrawal logic TBD
- Decentralized token sales or fundraising platforms.
- Crowdfunding with refund capabilities.
- Secure contract-based escrow services for ETH and tokens.
- Token Sale (TGE)
- Clone the repository:
git clone https://github.com/dvncan/CombinedEscrow.git
- Install forge libs
forge install OpenZeppelin/openzeppelin-contracts@4.8.0- Compile
forge build3.a Test
forge test --match-path test/CombinedEscrow.t.sol -vvv
