• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

cowprotocol / contracts / 5090697765
97%

Build:
DEFAULT BRANCH: main
Ran 26 May 2023 12:20PM UTC
Jobs 1
Files 22
Run time 1s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

26 May 2023 12:17PM UTC coverage: 97.398%. Remained the same
5090697765

push

github

web-flow
 Add task to create orders for the settlement contract  (#51)

Adds a task that creates orders on behalf of the settlement contract.

The task recovers balances for the input tokens and has the settlement
contract create partially fillable limit orders selling the recovered
balance in a call to `settle` through pre-signatures.
The user calls the script with parameters that are familiar from either
the `withdraw` or `dump` task
(`toToken`,`minValue`,`leftover`,`receiver`,`maxFeePercent`,`slippageBps`,`validity`,`dryRun`).
Most of the behavior is inherited from the existing scripts. For
example, it's possible to specify an origin to sell tokens with a Safe
multisig transaction.

Notably missing: the script doesn't set allowances: it cannot be used
_as is_ to sell arbitrary tokens but it assumes the required allowances
to already be present. I did this because this PR is already long to
review and the approval component is easy to separate from the existing
logic compared to the rest of this PR,

### How to review

This PR is published with two commits: the first copies the content of
`withdraw.ts` into `selfSell.ts`. The second modifies that file to
achieve what we want to do. I believe it's easier to just check the
second commit for changes, since the majority of the changes are trivial
except for a few key changes (switching from transferring to creating
orders, how the costs are computed, and submitting the orders to the
API). The commit is
[here](https://github.com/cowprotocol/contracts/commit/373afd97c).

### Test Plan

Try out the script with a few parameters. You can simulate the output by
creating the transaction from a [solver
safe](https://app.safe.global/transactions/queue?safe=gor:0xA03be496e67Ec29bC62F01a428683D7F9c204930).

<details>
<summary>
Example execution
</summary>

(The fee is high because I already withdrew most of the balance and I
had to make do with what wa... (continued)

160 of 172 branches covered (93.02%)

Branch coverage included in aggregate %.

364 of 366 relevant lines covered (99.45%)

37.8 hits per line

Jobs
ID Job ID Ran Files Coverage
1 5090697765.1 26 May 2023 12:20PM UTC 0
97.4
GitHub Action Run
Source Files on build 5090697765
Detailed source file information is not available for this build.
  • Back to Repo
  • 37f9cc64 on github
  • Prev Build on main (#5088937035)
  • Next Build on main (#5864702095)
  • Delete
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc