Skip to content

feat(ctf): add Gnosis Safe wallet support for CTF operations#215

Open
Haut wants to merge 2 commits intoPolymarket:mainfrom
Haut:feat/ctf-safe-wallet-support
Open

feat(ctf): add Gnosis Safe wallet support for CTF operations#215
Haut wants to merge 2 commits intoPolymarket:mainfrom
Haut:feat/ctf-safe-wallet-support

Conversation

@Haut
Copy link
Contributor

@Haut Haut commented Jan 22, 2026

Recreation of #172 with comments implemented

Add methods to execute CTF operations through a Gnosis Safe wallet, enabling users with Safe-based wallets to split, merge, and redeem positions.

New public methods:

  • split_position_via_safe
  • merge_positions_via_safe
  • redeem_positions_via_safe
  • redeem_neg_risk_via_safe

Each method accepts an optional Safe address parameter - if None, derives the Safe address from the signer's EOA using CREATE2.

Implementation details:

  • IGnosisSafe interface for nonce() and execTransaction()
  • SafeTx EIP-712 struct using Alloy's sol! macro
  • Correct signature v-value normalization (y-parity 0/1 → v 27/28)
  • Minimal EIP-712 domain (chainId + verifyingContract only)

Includes 17 unit tests covering EIP-712 type hashes, calldata encoding, signature format, and address derivation.

Add methods to execute CTF operations through a Gnosis Safe wallet,
enabling users with Safe-based wallets to split, merge, and redeem
positions.

New public methods:
- split_position_via_safe
- merge_positions_via_safe
- redeem_positions_via_safe
- redeem_neg_risk_via_safe

Each method accepts an optional Safe address parameter - if None,
derives the Safe address from the signer's EOA using CREATE2.

Implementation details:
- IGnosisSafe interface for nonce() and execTransaction()
- SafeTx EIP-712 struct using Alloy's sol! macro
- Correct signature v-value normalization (y-parity 0/1 → v 27/28)
- Minimal EIP-712 domain (chainId + verifyingContract only)

Includes 17 unit tests covering EIP-712 type hashes, calldata encoding,
signature format, and address derivation.
@codecov
Copy link

codecov bot commented Jan 22, 2026

Codecov Report

❌ Patch coverage is 60.33994% with 140 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.74%. Comparing base (fe8fc5b) to head (4bb320b).

Files with missing lines Patch % Lines
src/ctf/client.rs 60.33% 140 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #215      +/-   ##
==========================================
- Coverage   85.36%   83.74%   -1.62%     
==========================================
  Files          32       32              
  Lines        5103     5456     +353     
==========================================
+ Hits         4356     4569     +213     
- Misses        747      887     +140     
Flag Coverage Δ
rust 83.74% <60.33%> (-1.62%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Haut Haut marked this pull request as ready for review January 22, 2026 14:14
@WayneAl
Copy link

WayneAl commented Jan 27, 2026

Good! can't wait for this merge

@0xOnkel
Copy link
Contributor

0xOnkel commented Feb 11, 2026

any ETA for this? :)

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.

3 participants