Skip to content

DWELL: Pay your rent with a yield-bearing stablecoin#4

Merged
lyronctk merged 29 commits intoSeismicSystems:mainfrom
rohan-patra:main
Feb 11, 2025
Merged

DWELL: Pay your rent with a yield-bearing stablecoin#4
lyronctk merged 29 commits intoSeismicSystems:mainfrom
rohan-patra:main

Conversation

@rohan-patra
Copy link
Collaborator

@rohan-patra rohan-patra commented Feb 8, 2025

Summary

Added new token standard implementation and Foundry project setup:

  1. SERC20 Token Standard

    • Introduced SIERC20 interface
    • Implemented privacy-preserving ERC20 with shielded balances/transfers
    • Added USDY yield-bearing stablecoin using shares-based accounting
  2. Project Infrastructure

    • Set up Foundry project with:
      • Foundry.toml config
      • .env.example with local RPC
      • Comprehensive .gitignore
    • Added test suite and deployment scripts
    • Included forge-std library as dependency
  3. Documentation

    • Updated root README with token project details
    • Added dedicated tokens/README.md explaining:
      • Privacy/yield challenges
      • Architecture (SERC20/USDY)
      • License (AGPL-3.0)

@rohan-patra rohan-patra changed the title [DRAFT] feat: Implement SERC20 token standard with USDY stablecoin and Foundry project setup Feb 8, 2025
@rohan-patra rohan-patra changed the title feat: Implement SERC20 token standard with USDY stablecoin and Foundry project setup Implement SERC20 token standard with USDY stablecoin and Foundry project setup Feb 8, 2025
Copy link
Contributor

@raviriley raviriley left a comment

Choose a reason for hiding this comment

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

image
LGTM

@rohan-patra rohan-patra marked this pull request as ready for review February 8, 2025 08:40
@rohan-patra rohan-patra changed the title Implement SERC20 token standard with USDY stablecoin and Foundry project setup Implement SERC20 token standard with Yield Bearing (USDY) stablecoin Feb 8, 2025
@lyronctk
Copy link
Contributor

lyronctk commented Feb 8, 2025

image LGTM

LOL

@ssolit
Copy link
Contributor

ssolit commented Feb 8, 2025

Would propose the following two revisions:

  1. revert in private view functions instead of returning 0
    This would help dApps know whether the value is really zero or if something went wrong. It would be unfortunate for a dApp to believe something is really zero when it's not and use it for business logic. The contract could return a custom error, perhaps named UnauthorizedView?

How dApps could interface:
a) Caller contracts can use .call() to error handle if they want
b) The SRC20 could also provide a safeBalanceOf function that returns (bool success, uint256 balance)

  1. For ISRC20, instead of providing events, have emitEvent functions that must be overridden
    For the default SRC20, these should be no-ops because we assume users want complete privacy from indexers. However, these functions can be overridden with custom behavior, which leaves the door open to future improvements (i.e. encrypted events)
    Requires replacing all emits in the SRC20 with calls to emitApprovalEvent, etc

raviriley and others added 3 commits February 8, 2025 15:43
- Replace zero returns with UnauthorizedView errors in view functions
- Add safe view functions that return success boolean
- Replace direct event emission with virtual event functions
- Update tests to handle UnauthorizedView errors and event changes
@rohan-patra
Copy link
Collaborator Author

Would propose the following two revisions:

  1. revert in private view functions instead of returning 0
    This would help dApps know whether the value is really zero or if something went wrong. It would be unfortunate for a dApp to believe something is really zero when it's not and use it for business logic. The contract could return a custom error, perhaps named UnauthorizedView?

How dApps could interface: a) Caller contracts can use .call() to error handle if they want b) The SRC20 could also provide a safeBalanceOf function that returns (bool success, uint256 balance)

  1. For ISRC20, instead of providing events, have emitEvent functions that must be overridden
    For the default SRC20, these should be no-ops because we assume users want complete privacy from indexers. However, these functions can be overridden with custom behavior, which leaves the door open to future improvements (i.e. encrypted events)
    Requires replacing all emits in the SRC20 with calls to emitApprovalEvent, etc

I modified the original function to return the error, and added a new function that returns 0 on unauthorized attempts and also returns a boolean to indicate that the call was unsuccessful

Also updated the tests to expect the appropriate reverts

Copy link
Contributor

@ssolit ssolit left a comment

Choose a reason for hiding this comment

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

comments for USDY

@lyronctk lyronctk self-requested a review February 11, 2025 15:15
Copy link
Contributor

@lyronctk lyronctk left a comment

Choose a reason for hiding this comment

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

LGTM

@lyronctk lyronctk changed the title Implement SERC20 token standard with Yield Bearing (USDY) stablecoin DWELL: Pay your rent with a yield-bearing stablecoin Feb 11, 2025
@lyronctk lyronctk merged commit 9b8dfc1 into SeismicSystems:main Feb 11, 2025
1 check passed
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.

4 participants