diff --git a/README.md b/README.md index 7982893..db6359a 100644 --- a/README.md +++ b/README.md @@ -1 +1,70 @@ -## Drip +# Drip Protocol + +A decentralized challenge and profile management system built on Ethereum. + +## Overview + +Drip Protocol is a smart contract system that enables users to create and manage challenges, maintain profiles, and handle token vaults. The protocol consists of several key components: + +- Challenge: Manages individual challenges +- ChallengeManager: Orchestrates challenge creation and management +- DripProfile: Handles user profiles and their associated data +- DripVault: Manages token deposits and withdrawals + +## Contract Addresses + +Challenge: 0xaDcaAe61b8983940FB2c8098BDe112e507A0e1f0 +ChallengeManager: 0xB3084eF0Dc7440e32A6cD64e2E5072FBCd9AEEeE +DripProfile: 0x0E69Ba1FF53c36D0fbb4fccC0e9B732D58593B2f + +### Testnet (Goerli) + +- Challenge: [Contract Address] +- ChallengeManager: [Contract Address] +- DripProfile: [Contract Address] +- DripVault: [Contract Address] + +## Architecture + +The protocol consists of four main contracts: + +1. **Challenge.sol**: Core contract for challenge creation and management + + - Handles challenge parameters + - Manages challenge states + - Processes challenge completion + +2. **ChallengeManager.sol**: Orchestration layer for challenges + + - Creates new challenges + - Manages challenge lifecycle + - Handles challenge verification + +3. **DripProfile.sol**: User profile management + + - Stores user information + - Tracks challenge participation + - Manages user achievements + +4. **DripVault.sol**: Token management + - Handles token deposits + - Processes withdrawals + - Manages challenge stakes + +## Libraries + +### TimeLib + +Utility library for time-based calculations and validations used throughout the protocol. + +### Types + +Contains core data structures and custom types used across the protocol. + +## Security + +This protocol has been designed with security in mind. However, it has not been audited yet. Use at your own risk. + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. diff --git a/script/Deploy.s.sol b/script/Deploy.s.sol index 595e431..6de6071 100644 --- a/script/Deploy.s.sol +++ b/script/Deploy.s.sol @@ -14,18 +14,11 @@ import {BaseDeploy} from "./BaseDeploy.s.sol"; contract Deploy is BaseDeploy { using TimeLib for uint256; - // Constants + // Constants uint256 private constant DURATION = 5 days; address private constant MOCK_TOKEN = 0x235c36243BD73d65B530a469658FeF591daA2f45; // Vault: underlying token - // Accounts - address private constant CLE = 0x8D0B05b837FB0e28e78b8939dDaD8CE7B91b678D; - address private constant SHA = 0xE033dfbeE8CB2DaE2F4FB13acb5d493f1fDEA318; - - // Private Keys - uint256 internal immutable ShanePrivateKey = vm.envUint("PRIVATE_KEY_SHA"); - // Contract Instances Challenge challenge; ChallengeManager challengeManager; @@ -36,10 +29,6 @@ contract Deploy is BaseDeploy { function run() public { _deployContracts(); - - // DEMO ONLY - _initializeEpochs(); - _createProfiles(); } function _deployContracts() private broadcast(deployerPrivateKey) { @@ -65,53 +54,4 @@ contract Deploy is BaseDeploy { bytes32 salt = _calculateSalt(fileName); return Create2.deploy(0, salt, creationBytecode); } - - function _initializeEpochs() private broadcast(deployerPrivateKey) { - uint256 currentTimestamp = block.timestamp; - _createEpoch(0, currentTimestamp - 5 days, "ETHGlobal Bangkok Demo"); - _createEpoch(1, currentTimestamp - 3 days, "TOEFL 7000 words"); - console.log("Epochs initialized"); - } - - /// @notice DEMO only - Helper function to create an epoch - function _createEpoch(uint256 id, uint256 startTimestamp, string memory description) private { - DripVault vault = new DripVault(MOCK_TOKEN, address(challengeManager)); - Types.Epoch memory epoch = Types.Epoch({ - id: id, - startTimestamp: startTimestamp, - endTimestamp: startTimestamp + DURATION, - durationInDays: DURATION.convertSecondsToDays(), - vault: address(vault), - asset: MOCK_TOKEN, - description: description, - participantCount: 0, - totalDeposits: 0 - }); - challengeManager.setEpoch(id, epoch); - } - - /// @notice DEMO only - Helper function to create profiles - function _createProfiles() private { - _createProfile("@clement", vm.envUint("PRIVATE_KEY")); - _createProfile("@shane", vm.envUint("PRIVATE_KEY_SHA")); - } - - function _createProfile(string memory handle, uint256 pk) private broadcast(pk) { - address account = vm.addr(pk); - uint32[] memory avatar = _createAvatar(pk); - uint256 profileId = profile.createProfile(account, handle, avatar); - Types.Profile memory createdProfile = profile.getProfileById(profileId); - profiles[account] = createdProfile; - console.log(handle, "profile with ID:", profileId); - } - - function _createAvatar(uint256 seed) private pure returns (uint32[] memory avatar) { - avatar = new uint32[](5); - for (uint32 i; i < 5;) { - avatar[i] = uint32((uint256(keccak256(abi.encodePacked(seed, i)))) + 3); - unchecked { - i++; - } - } - } }