Skip to content

feat(contract): implement pool-manager finance_invoice() with limit checks - #58

Merged
codemagician1949 merged 1 commit into
IntensifierLab:mainfrom
kulayddon:feat/issue-19-finance-invoice-limits
Aug 21, 2026
Merged

codemagician1949 merged 1 commit into
IntensifierLab:mainfrom
kulayddon:feat/issue-19-finance-invoice-limits

Conversation

@kulayddon

Copy link
Copy Markdown
Contributor

Closes #19

  • set_concentration_limits() configures per-buyer/per-SME concentration caps (bps of total pool capital)
  • finance_invoice() checks both caps plus the existing pool utilisation cap (via finance()), rejecting the call if either would be breached
  • On success, cross-contract calls into invoice-registry's assign() entrypoint (env.invoke_contract) to transition the invoice to the pool
  • Tracks cumulative per-buyer/per-SME exposure in persistent storage
  • InvoiceFinanced event emitted
  • Tests: successful finance + real cross-contract assignment (registers both contracts), buyer-limit breach reverts, pool-utilisation breach reverts

@kulayddon
kulayddon force-pushed the feat/issue-19-finance-invoice-limits branch 3 times, most recently from 17ba95f to bbb36c0 Compare August 19, 2026 15:35
…hecks

- set_concentration_limits() configures per-buyer/per-SME concentration
  caps (basis points of total pool capital)
- finance_invoice() checks both caps plus the existing pool utilisation
  cap (via finance()), returning a typed ContractError if either would be
  breached
- On success, cross-contract calls into invoice-registry's assign()
  entrypoint (env.invoke_contract) to transition the invoice to the pool
- Tracks cumulative per-buyer/per-SME exposure in persistent storage,
  with a marker field on each key so storage slots can't collide
  (contracttype tuple structs have no type discriminant)
- InvoiceFinanced event emitted
- Tests: successful finance + real cross-contract assignment (registers
  both contracts), buyer-limit breach errors, pool-utilisation breach
  errors

Closes IntensifierLab#19
@kulayddon
kulayddon force-pushed the feat/issue-19-finance-invoice-limits branch from bbb36c0 to f2eca75 Compare August 21, 2026 01:05
@codemagician1949
codemagician1949 merged commit 6921c02 into IntensifierLab:main Aug 21, 2026
3 checks passed
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.

feat(contract): implement pool-manager finance_invoice() with limit checks

2 participants