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]: Implement ERC20 Multi-Recipient Escrow Contract #96

Open
12 tasks done
Gerson2102 opened this issue Jan 21, 2025 · 8 comments · May be fixed by #111
Open
12 tasks done

[FEAT]: Implement ERC20 Multi-Recipient Escrow Contract #96

Gerson2102 opened this issue Jan 21, 2025 · 8 comments · May be fixed by #111
Assignees
Labels
enhancement New feature or request ODBoost This issue will be available ONLY during the ODBoost

Comments

@Gerson2102
Copy link
Contributor

Gerson2102 commented Jan 21, 2025

📘 Description

We need to implement a secure escrow smart contract in Cairo for Starknet that will act as a trustless intermediary for ERC20 token transactions. The contract should support multiple potential recipients for each order, with only one eventual winner receiving the funds. This will enable use cases like marketplace transactions, competition prizes, or conditional payments.

The contract should manage the complete lifecycle of an escrow order from creation through payment and completion/cancellation, while ensuring secure token transfers and proper state management.

✅ Acceptance Criteria

Order Management

  • Contract must support creating orders with multiple potential recipients
  • Each order must store:
    • Amount of tokens to be escrowed
    • List of potential recipient addresses
    • Current state (NotPaid, Paid, Completed, Cancelled)
  • Order IDs should be unique and auto-incrementing

Token Handling

  • Contract must safely interact with any ERC20 token
  • Must validate sufficient token balance before transfers
  • Must handle token transfer failures appropriately
  • Must store escrowed tokens in the contract until completion

State Transitions

  • Orders start in 'NotPaid' state
  • Payment can only be made for 'NotPaid' orders
  • Only paid orders can be completed
  • Orders can be cancelled from any state
  • Completion must transfer tokens to the designated winner

🌎 References

@Gerson2102 Gerson2102 added the enhancement New feature or request label Jan 21, 2025
@Gerson2102
Copy link
Contributor Author

Lmk what you think @danielcdz

@danielcdz
Copy link
Member

@Gerson2102 this LGTM

@danielcdz danielcdz added the ODBoost This issue will be available ONLY during the ODBoost label Jan 21, 2025
@armaanansari121
Copy link

Hey, The issue seems interesting. This is just an enquiry about some details before ODBoost begins.

  1. Can the orders have different tokens?
  2. Do we send over the tokens while placing an order?
  3. How are we selecting the recipient and is it supposed to be only selected by the owner of the contract?

@Kingsuite
Copy link

Let me try this one!

@SoarinSkySagar
Copy link
Contributor

may i take up this issue @coxmars?

background: cairo dev with 5 months of experience and regular contributor at @keep-starknet-strange

eta: 2 days

@armaanansari121
Copy link

armaanansari121 commented Jan 22, 2025

Hey, may I take up this issue?
I think I understand the picture, I implemented a similar lottery contract recently in the starknet winter hackathon. Which involved in managing states of the contract and release of funds.

ETA: 2 days

@emarc99
Copy link
Contributor

emarc99 commented Jan 22, 2025

Would love to tackle this! ETA - 3days max!

@Jagadeeshftw
Copy link

Proposal to Work on the Issue

I would be delighted to contribute to this issue, as I have extensive experience with Cairo programming and developing decentralized applications on StarkNet.

Estimated Timeline

I anticipate delivering a working solution within the next 24 hours. Please let me know if I can proceed.

Looking forward to contributing and collaborating!

Best regards,
Jagadeesh B

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request ODBoost This issue will be available ONLY during the ODBoost
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants