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

Bagel refactor #5

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open

Bagel refactor #5

wants to merge 8 commits into from

Conversation

bagelface
Copy link
Collaborator

  • Fix tests
  • Refactor core functionality, variables, errors, functions, etc.
  • Add NatSpec comments
  • Bump Solidity version

This was linked to issues Dec 26, 2024
Copy link
Contributor

@RonTuretzky RonTuretzky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have not gone over tests yet, will follow up

foundry.toml Show resolved Hide resolved
* @notice Simple implementation of a rotating savings and credit association (ROSCA) for ERC20 tokens
* @author Breadchain Collective
* @author @RonTuretzky
* @author @bagelface
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on the YD contract everyone has their ENS, wdyt our convention should be for tagging authors?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ya i personally like ENS, i think we should just put it however the author requests. do you want me to use your ENS for this?

* @param _circle A new saving circle
*/
function create(Circle memory _circle) external override {
bytes32 _id = keccak256(abi.encodePacked(_circle.name));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking a lot about how maybe the ID should be a hash of all the variables + timestamp? so there can be name collisions. Not sure if it's worth it or not.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh i cant think of any reason to not just use serial ids (like you would do if you were just minting new NFTs) and return the value when a new circle is created

* @notice Make a withdrawal from a specified circle
* @param _id Identifier of the circle
*/
function withdraw(bytes32 _id) external override nonReentrant {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, we might want to make a withdrawFor function in order to allow withdrawing for another member in the event they are unable (like the depositFor functionality)

Comment on lines +122 to +123
if (_circle.owner != msg.sender) {
if (!isMember[_id][msg.sender]) revert NotMember();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the value of having access control here for the circle members as opposed to permissionless?

My concern is that practically what will happen is we /chain coop will have to decommission these, not the members themselves...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i usually like to avoid "godmode" functions, but if we think we need it we can add it. it just gives the circle members complete control which is a good or bad thing depending on perspective

block.timestamp < circles[_id].circleStart
|| block.timestamp >= circles[_id].circleStart + (circles[_id].depositInterval * (circles[_id].currentIndex + 1))
|| block.timestamp >= circles[_id].circleStart + (circles[_id].depositInterval * circles[_id].maxDeposits)
|| balances[_id][_member] + _value > circles[_id].depositAmount
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering if allowing flexibility in the deposit amount instead of only allowing the full amount contributes to ux or makes it more confusing.. thoughts @diterra-code ?

error TransferFailed();

// External functions (state-changing)
function initialize(address owner) external;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't the wonderland convention to put the natspec here and inheritdoc the contract?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh idk, is it? seems sort of strange but if that's convention i can change it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Functional V1 Implementation Add NatSpec comments
2 participants