(!This project is currently under development and testing!)
Safe.kolot.lu is a decentralized escrow contract for secure milestone-based project payments. It facilitates secure transactions between clients and executors with transparent and fair fund management using ERC20/TRC20 tokens.
- Decentralized Escrow: Securely manage payments between clients and executors.
- Milestone-Based Payments: Break down project payments into milestones.
- Platform Fees: Deduct platform fees from project budgets.
- Cancellation and Refunds: Allow project cancellation and client refunds.
- Upgradeable Contracts: Utilize OpenZeppelin's upgradeable contracts.
Safe.sol
: The main contract handling project creation, milestone payments, and cancellations.TestERC20.sol
: A mock ERC20 token used for testing.
.
βββ LICENSE
βββ README.md
βββ contracts
β βββ Safe.sol
β βββ ...
βββ hardhat.config.ts
βββ package-lock.json
βββ package.json
βββ scripts
β βββ deploy.ts
β βββ ...
βββ test
β βββ utils.ts
β βββ safe
β βββ 1_deployment.test.ts
β βββ 2_projectCreation.test.ts
β βββ ...
βββ tsconfig.json
- Node.js
- npm or yarn
- Hardhat
- An Ethereum wallet with testnet or mainnet access
- Clone the repository:
git clone https://github.com/Kolot-lu/Safe.git
cd Safe
- Install dependencies:
npm install
# or
yarn install
- Create a
.env
file in the root directory and add the following variables:
SEPOLIA_URL=https://sepolia.infura.io/v3/YOUR_INFURA_PROJECT_ID
PRIVATE_KEY=your_private_key
TRON_SHASTA_URL=https://api.shasta.trongrid.io
TRON_PRIVATE_KEY=your_tron_private_key
Compile the smart contracts using Hardhat:
npx hardhat compile
Run the tests to ensure everything is working correctly:
npx hardhat test
To deploy the contracts to a local Hardhat network:
npx hardhat node
npx hardhat run scripts/deploy.ts --network localhost
To deploy the contracts to a testnet (e.g., Sepolia) or mainnet:
npx hardhat run scripts/deploy.ts --network sepolia
# or
npx hardhat run scripts/deploy.ts --network mainnet
Use the createProject
function to create a new project with specified milestones and platform fee.
function createProject(
address _executor,
uint256 _totalAmount,
uint256[] memory _milestoneAmounts,
uint256 _platformFeePercent,
IERC20 _token
) public
Use the fundProject
function to fund a previously created project.
function fundProject(uint256 _projectId) public
Use the confirmMilestone
function to confirm the completion of a milestone and release funds to the executor.
function confirmMilestone(uint256 _projectId) public
Use the cancelProject
function to cancel a project and refund the client.
function cancelProject(uint256 _projectId) public
The owner can withdraw accumulated platform fees using the withdrawPlatformFunds
function.
function withdrawPlatformFunds(IERC20 _token) public onlyOwner
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenZeppelin for their excellent library of secure smart contract components.
- Hardhat for providing a robust development environment for Ethereum software.