Skip to content

Conversation

@AuHau
Copy link
Contributor

@AuHau AuHau commented Mar 24, 2025

Closes #186

Based on the Vault integration worked.

- changes balance from uint256 -> uint128
  so that entire Balance can be read or written
  with a single operation
- moves Lock to library
- simplifies lock checks
markspanbroek and others added 15 commits March 4, 2025 09:36
- move all collateral calculatons to separate library
so that they can no longer be transfered
within the vault
This state is no longer necessary, vault ensures
that payouts happen only once. Hosts could bypass
this state anyway by withdrawing from the vault
directly.
- changes to marketplace constructor
- we no longer have _marketplaceTotals
- timestamps have their own type now
- freeSlot no longer takes payout addresses
- slot state 'Paid' no longer exists
- freeSlot can be invoked more than once now
- a failed request no longer ends immediately
No need to test the token itself
It is no longer a discount on the collateral, to
simplify reasoning about collateral in the sales
module of the codex node
Copy link
Collaborator

@emizzle emizzle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice job! One request for an additional test, but nothing blocking, so will approve now 👍

Comment on lines +17 to +21
function maxPriceWithProtocolFee(request, config) {
return maxPrice(request) + protocolFee(request, config)
}

function maxPriceWithProtocolFee(request, config) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do these functions not have the exact same signature?

TokensPerSecond pricePerSecond = request.ask.pricePerSecond();
uint128 price = pricePerSecond.accumulate(request.ask.duration);

_collectProtocolFee(request.client, request.ask);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm assuming this function and _transferToVault(request.client, fund, account, price); would revert with "insufficient funds" if the user does not have enough funds to cover both the fee and the price?

)
})

it("is not returned when request is cancelled", async function () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add a similar test for failed? Since now I believe with the Vault the client gets refunded if the request fails...

const startBalance = await token.balanceOf(client.address)
await marketplace.withdrawFunds(slot.request)
const endBalance = await token.balanceOf(client.address)
expect(endBalance - startBalance).to.equal(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why we do not check the dead balance here ?

@emizzle
Copy link
Collaborator

emizzle commented Apr 17, 2025

@AuHau let's get this updated so we can merge it please?

@AuHau
Copy link
Contributor Author

AuHau commented Apr 17, 2025

It is based on Vault integration, which is not merged in yet so pretty pointless to update... 😉

@emizzle
Copy link
Collaborator

emizzle commented Apr 17, 2025

But the Vault work was merged, no?

@AuHau
Copy link
Contributor Author

AuHau commented Apr 17, 2025

Well yes and no ;-)
Vault itself yes, but not its integration: #223 (and that is actually what is this PR based on)

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.

5 participants