This repo is composed of GroupBillFactory
and GroupBill
contracts. GroupBillFactory
creates GroupBill contracts for a specific msg.sender
. Here is a short workflow example:
- User creates a
GroupBill
with the nameJapan Trip, Jun 2024
with 5 participants (5 corresponding addresses not including the creator). At this point, dai token address is exported through env vars and hardcoded into the contract. - Each user joins the contract and adds their corresponding expenses. After that, permit method is then called so that users who borrowed from someone else in the group could settle up + .5 dai static fee.
- After everyone has approved their tokens as payback, collective settlement is triggered by one of the users.
- Assuming everyone has sufficient balances, settlement is successfully executed.
Clone the repo:
git clone [email protected]:zatarx/forge-contracts.git && cd forge-contracts
Initialize submodules:
git submodule update --init --recursive
Run build to check the installation:
forge build
To add a new dependency:
git submodule add <submodule_url> lib/<submodule_name>
# then refresh your remappints
# can be done with `forge remappings` command or by hand