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

simplify the token timelock example #359

Open
tomerweller opened this issue Jan 20, 2025 · 0 comments
Open

simplify the token timelock example #359

tomerweller opened this issue Jan 20, 2025 · 0 comments

Comments

@tomerweller
Copy link
Contributor

The token timelock example is important because it's a well understood simple concept that touches on how to work with tokens. I propose implementing a few simplifications/clarifications in order to enhance it's readability and usability as learning material:

  • Consistent naming: the folder is named timelock but the contract is called CalimbaleBalance. I suggest standardizing on token-timelock and TokenTimelockContract
  • Remove Timebound and only support "valid after" semantics
  • Support a single claimant instead of a vector of claimants
  • Migrate from deposit() to a p22 constructor
leighmcculloch added a commit that referenced this issue Jan 22, 2025
Related to #359

Simplify the token timelock example by renaming, supporting a single claimant, and using a p22 constructor.

* **Renaming:**
  - Rename the folder to `token-timelock`.
  - Rename the contract to `TokenTimelockContract` in `token-timelock/src/lib.rs`.

* **Single Claimant Support:**
  - Update `ClaimableBalance` struct to support a single claimant instead of a vector of claimants in `token-timelock/src/lib.rs`.

* **p22 Constructor:**
  - Replace the `deposit` function with a p22 constructor named `__constructor` in `token-timelock/src/lib.rs`.

* **Time Bound:**
  - Update `TimeBound` struct to only support "valid after" semantics in `token-timelock/src/lib.rs`.

* **Tests:**
  - Update tests to use `TokenTimelockContract` and support a single claimant in `token-timelock/src/test.rs`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/stellar/soroban-examples/issues/359?shareId=XXXX-XXXX-XXXX-XXXX).
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

No branches or pull requests

1 participant