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

Settler exo #10391

Closed
turadg opened this issue Nov 1, 2024 · 2 comments · Fixed by #10530
Closed

Settler exo #10391

turadg opened this issue Nov 1, 2024 · 2 comments · Fixed by #10530
Assignees
Labels
enhancement New feature or request

Comments

@turadg
Copy link
Member

turadg commented Nov 1, 2024

What is the Problem Being Solved?

Fast USDC needs a component to settle advances.

Description of the Design

A Settler exo that performs the advancement operations.

It looks them up from Status Manager and settles per product spec.

Security Considerations

Scaling Considerations

Test Plan

Exo test

Contract test is separate: #10388

Upgrade Considerations

@turadg turadg added the enhancement New feature or request label Nov 1, 2024
@turadg turadg added this to the FU1: package integration milestone Nov 1, 2024
@dckc dckc mentioned this issue Nov 4, 2024
5 tasks
@0xpatrickdev 0xpatrickdev assigned dckc and unassigned 0xpatrickdev Nov 18, 2024
@dckc
Copy link
Member

dckc commented Nov 19, 2024

collecting details on the scope of this issue...

design sketch says:

An exo within FUC that handles settling transactions.

  • Taps the SettlementAccount to be notified of deposits
  • Extracts the EUD from the address parameters of the virtual address receiving the deposit
  • Looks up associated transaction using an Advancer method
  • Processes according to the sequence diagram
    • When in doubt, hold funds
  • Informs advancer of settlement

re "the SettlementAccount" - that presumes there is one. Does this exo make it?

@dckc
Copy link
Member

dckc commented Nov 19, 2024

re "settles per product spec" - this bit of the diagram seems particularly relevant:

sequenceDiagram
    rect rgb(255, 245, 230)
        Note over FUC,CFA: Settlement Process
        Note over FUC,SA: Tap on account reads MintAmount,<br/>parses EUD from virtual address recipient<br/>and looks up AdvanceAmount,PoolFee,ContractFee.<br/>Matches against an unsettled transaction (by EUD and approx amount).
        %% Treat starting the advance as an atomic action. Assume it will complete once started.
        alt Advance was started:
            FUC->>SA: Initiate transfers<br>out of settlement
            SA->>P: Deposit the AdvanceAmount + PoolFee<br>(= MintAmount - ContractFee)
            SA->>CFA: Deposit ContractFee
        else Advance for matched transaction that has not yet started:
            P->>NC: PFM transfer<br>(MintAmount of Agoric USDC denom) to EUD
            NC->>EUD: deliver MintAmount<br>as final USDC denom
        else Settlement for unknown transaction:
            %% Have not received notification of this Amount,EUD from the watcher
            Note over SA: Leave funds in SettlementAccount.
            Note over SA: Wait for observation from watcher
        end
    end
Loading

mergify bot added a commit that referenced this issue Nov 25, 2024
refs: #10391

## Description

There was a race in subscribeToTransfers. Use a `Vow` to avoid the race.

### Security / Scaling / Upgrade / Documentation Considerations

can't think of any

### Testing Considerations

I'm not sure how to make a test for this. The purpose of this fix is mostly to stop other tests from failing.
@mergify mergify bot closed this as completed in #10530 Nov 25, 2024
mergify bot added a commit that referenced this issue Nov 25, 2024
closes: #10391

## Description

 - feat(fast-usdc): settler disburses or forwards funds

Discussion of what to do if the minted USDC shows up at each state led to some refinement of states.
So the scope of this PR expanded somewhat:

 - chore(fast-usdc): status manager: split out Advancing state
 - chore(fast-usdc): advancer: split ADVANCING state


### Security Considerations

In addition to the normal case where funds are repaid to the pool and fees are distributed, the settler is responsible to forward funds in case they were not advanced.

### Scaling Considerations

nothing novel

### Documentation Considerations

Readers are assumed to be familiar with design docs.

### Testing Considerations

Getting the tests to pass requires:

 - [ ] #10553

It's included in this PR for now but is expected to land separately

DRAFT until
 - [x] test "Settlement for unknown transaction" case

### Upgrade Considerations

This is a new component.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants