Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat:new tests added and 1 failed #1

Open
wants to merge 24 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
271d0e8
chore: Switch to from solmate to openzeppelin
mgnfy-view Oct 25, 2024
884aaf0
chore: Remmove the formatting stage from the github workflow
mgnfy-view Oct 26, 2024
19099aa
feat: Finish writing admin controls
mgnfy-view Oct 26, 2024
61c4cef
feat: Write the logic to create streams, set recipient vault, and hoo…
mgnfy-view Oct 26, 2024
fcda6ee
chore: Update interfaces
mgnfy-view Oct 27, 2024
4d800e7
feat: Finish writing the chore functionalities
mgnfy-view Oct 27, 2024
e437d98
feat: Add a deployment script
mgnfy-view Oct 27, 2024
0690b39
chore: Add a command to deploy locally
mgnfy-view Oct 27, 2024
442f683
fix: Fix some contract logic issues
mgnfy-view Oct 27, 2024
8569f1b
refactor: Add a fee amount field to the hooks called before and after…
mgnfy-view Oct 27, 2024
5bd3855
fix: Return a uint16 instead of a uint256 from the getFeeInBasisPoint…
mgnfy-view Oct 27, 2024
a1deaed
fix: Remove the pause/unpause functionality
mgnfy-view Oct 28, 2024
77b42c7
chore: Whitelist PYUSD for streaming on deployment script
mgnfy-view Oct 28, 2024
e5fba84
chore: Add more NatSpec to contract
mgnfy-view Oct 28, 2024
e5fc66d
chore: Add functions to the interface
mgnfy-view Oct 28, 2024
57ed5cf
feat: Add base vault implementation
mgnfy-view Oct 28, 2024
76c72a8
feat: Add a payment splitter hook example
mgnfy-view Oct 28, 2024
c262256
feat: Add a good README.md!
mgnfy-view Oct 28, 2024
5979ebc
fix: README.md fix
mgnfy-view Oct 28, 2024
acd7fcd
fix: Fix some bugs in PayStreams contract
mgnfy-view Oct 28, 2024
c91aa13
refactor: Make event fields indexed
mgnfy-view Oct 28, 2024
8f5b0c4
refactor: Add the getAmountToCollectFromStreamAndFeeToPay() function …
mgnfy-view Oct 28, 2024
81aa310
fix: Do not delete the entire stream data when caancelling the stream
mgnfy-view Oct 29, 2024
2ddd18c
feat:new tests added and 1 failed
olahamid Oct 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ jobs:
run: |
forge --version

- name: Run Forge fmt
run: |
forge fmt --check
id: fmt

- name: Run Forge build
run: |
forge build --sizes
Expand Down
6 changes: 3 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
[submodule "lib/solmate"]
path = lib/solmate
url = https://github.com/transmissions11/solmate
[submodule "lib/openzeppelin-contracts"]
path = lib/openzeppelin-contracts
url = https://github.com/openzeppelin/openzeppelin-contracts
6 changes: 4 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ clean :; forge clean

remove :; rm -rf .gitmodules && rm -rf .git/modules/* && rm -rf lib && touch .gitmodules && git add . && git commit -m "modules"

install :; forge install foundry-rs/forge-std --no-commit && forge install transmissions11/solmate --no-commit
install :; forge install foundry-rs/forge-std --no-commit && forge install openzeppelin/openzeppelin-contracts --no-commit

update :; forge update

Expand All @@ -20,4 +20,6 @@ format-sol :; forge fmt

anvil :; anvil -m 'test test test test test test test test test test test junk' --steps-tracing --block-time 1

precommit :; forge fmt && git add .
precommit :; forge fmt && git add .

deploy-local :; forge script script/DeployPayStreams.s.sol --rpc-url 127.0.0.1:8545 --private-key 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80 --broadcast
159 changes: 121 additions & 38 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,66 +1,149 @@
## Foundry
<!-- PROJECT SHIELDS -->

**Foundry is a blazing fast, portable and modular toolkit for Ethereum application development written in Rust.**
[![Contributors][contributors-shield]][contributors-url]
[![Forks][forks-shield]][forks-url]
[![Stargazers][stars-shield]][stars-url]
[![Issues][issues-shield]][issues-url]
[![MIT License][license-shield]][license-url]

Foundry consists of:
<!-- PROJECT LOGO -->
<br />
<div align="center">
<!-- <a href="https://github.com/mgnfy-view/pay-streams">
<img src="assets/icon.svg" alt="Logo" width="80" height="80">
</a> -->

- **Forge**: Ethereum testing framework (like Truffle, Hardhat and DappTools).
- **Cast**: Swiss army knife for interacting with EVM smart contracts, sending transactions and getting chain data.
- **Anvil**: Local Ethereum node, akin to Ganache, Hardhat Network.
- **Chisel**: Fast, utilitarian, and verbose solidity REPL.
<h3 align="center">PayStreams</h3>

## Documentation
<p align="center">
PayStreams is a payment streaming service leveraging PyUSD, supercharged with hooks
<br />
<a href="https://github.com/mgnfy-view/pay-streams/issues/new?labels=bug&template=bug-report---.md">Report Bug</a>
·
<a href="https://github.com/mgnfy-view/pay-streams/issues/new?labels=enhancement&template=feature-request---.md">Request Feature</a>
</p>
</div>

https://book.getfoundry.sh/
<!-- TABLE OF CONTENTS -->
<details>
<summary>Table of Contents</summary>
<ol>
<li>
<a href="#about-the-project">About The Project</a>
<ul>
<li><a href="#built-with">Built With</a></li>
</ul>
</li>
<li>
<a href="#getting-started">Getting Started</a>
<ul>
<li><a href="#prerequisites">Prerequisites</a></li>
<li><a href="#installation">Installation</a></li>
</ul>
</li>
<li><a href="#roadmap">Roadmap</a></li>
<li><a href="#contributing">Contributing</a></li>
<li><a href="#license">License</a></li>
<li><a href="#contact">Contact</a></li>
</ol>
</details>

## Usage
<!-- ABOUT THE PROJECT -->

### Build
## About The Project

```shell
$ forge build
```
PayStreams is a payment streaming service which allows anyone to open token streams directed to any recipient. The recipient can collect the streamed funds over time, or when the stream ends. The stream creator can update, or cancel the stream as well. Streams can be one-time, or recurring.

### Test
PayStreams leverages the stability of PYUSD to avoid the volatilities of crypto coins, and ensures that the streaming service is reliable and pays out the correct value at any time. Additionally, we introduce hooks, which are functions with custom logic that can be invoked at various points during the stream's lifespan. To opt into hooks, both the streamer and the recipient can set custom vaults with correct functions and hook configuration, and these functions will be invoked by the `PayStreams` contract when certain events occur. Hooks open up a wide array of use cases and customizations, enabling developers to extend the functionality of streams. You can find some hook examples in the `./src/exampleHooks/` folder.

```shell
$ forge test
```
P.S. This project was built for the BuildOn hackathon on Devfolio.

### Format
### Built With

```shell
$ forge fmt
```
- Solidity
- Foundry

### Gas Snapshots
<!-- GETTING STARTED -->

```shell
$ forge snapshot
```
## Getting Started

### Anvil
### Prerequisites

```shell
$ anvil
```
Make sure you have git, rust, and foundry installed and configured on your system.

### Deploy
### Installation

Clone the repo,

```shell
$ forge script script/Counter.s.sol:CounterScript --rpc-url <your_rpc_url> --private-key <your_private_key>
git clone https://github.com/mgnfy-view/pay-streams.git
```

### Cast
cd into the repo, and install the necessary dependencies

```shell
$ cast <subcommand>
cd pay-streams
forge build
```

### Help
Run tests by executing

```shell
$ forge --help
$ anvil --help
$ cast --help
forge test
```

That's it, you are good to go now!

<!-- ROADMAP -->

## Roadmap

- [x] Smart contract development
- [ ] Unit tests
- [x] Write a good README.md

See the [open issues](https://github.com/mgnfy-view/pay-streams/issues) for a full list of proposed features (and known issues).

<!-- CONTRIBUTING -->

## Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".
Don't forget to give the project a star! Thanks again!

1. Fork the Project
2. Create your Feature Branch (`git checkout -b feature/AmazingFeature`)
3. Commit your Changes (`git commit -m 'Add some AmazingFeature'`)
4. Push to the Branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

<!-- LICENSE -->

## License

Distributed under the MIT License. See `LICENSE.txt` for more information.

<!-- CONTACT -->

## Reach Out

Here's a gateway to all my socials, don't forget to hit me up!

[![Linktree](https://img.shields.io/badge/linktree-1de9b6?style=for-the-badge&logo=linktree&logoColor=white)][linktree-url]

<!-- MARKDOWN LINKS & IMAGES -->
<!-- https://www.markdownguide.org/basic-syntax/#reference-style-links -->

[contributors-shield]: https://img.shields.io/github/contributors/mgnfy-view/pay-streams.svg?style=for-the-badge
[contributors-url]: https://github.com/mgnfy-view/pay-streams/graphs/contributors
[forks-shield]: https://img.shields.io/github/forks/mgnfy-view/pay-streams.svg?style=for-the-badge
[forks-url]: https://github.com/mgnfy-view/pay-streams/network/members
[stars-shield]: https://img.shields.io/github/stars/mgnfy-view/pay-streams.svg?style=for-the-badge
[stars-url]: https://github.com/mgnfy-view/pay-streams/stargazers
[issues-shield]: https://img.shields.io/github/issues/mgnfy-view/pay-streams.svg?style=for-the-badge
[issues-url]: https://github.com/mgnfy-view/pay-streams/issues
[license-shield]: https://img.shields.io/github/license/mgnfy-view/pay-streams.svg?style=for-the-badge
[license-url]: https://github.com/mgnfy-view/pay-streams/blob/master/LICENSE.txt
[linktree-url]: https://linktr.ee/mgnfy.view
1 change: 1 addition & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
src = "src"
out = "out"
libs = ["lib"]
remappings = ["@openzeppelin=lib/openzeppelin-contracts/contracts"]

[fmt]
sort_imports = true
Expand Down
1 change: 1 addition & 0 deletions lib/openzeppelin-contracts
Submodule openzeppelin-contracts added at 448efe
1 change: 0 additions & 1 deletion lib/solmate
Submodule solmate deleted from 97bdb2
20 changes: 20 additions & 0 deletions script/DeployPayStreams.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import { Script } from "forge-std/Script.sol";

import { PayStreams } from "../src/PayStreams.sol";

contract DeployPayStreams is Script {
uint16 feeInBasisPoints = 10;
address public constant PYUSD = 0xCaC524BcA292aaade2DF8A05cC58F0a65B1B3bB9;

function run() external returns (address) {
vm.startBroadcast();
PayStreams stream = new PayStreams(feeInBasisPoints);
stream.setToken(PYUSD, true);
vm.stopBroadcast();

return address(stream);
}
}
Loading