Skip to content

Escrow contract for Nfts#22

Closed
lemunozm wants to merge 9 commits intomainfrom
feat/rwa-escrow
Closed

Escrow contract for Nfts#22
lemunozm wants to merge 9 commits intomainfrom
feat/rwa-escrow

Conversation

@lemunozm
Copy link
Contributor

@lemunozm lemunozm commented Oct 22, 2024

Description

Implementation of an escrow to handle NFTs (collaterals from the portfolio)

This PR needs to be merged before #5

@lemunozm lemunozm self-assigned this Oct 22, 2024
import {Auth} from "src/Auth.sol";
import {IERC6909, INftEscrow} from "src/interfaces/INftEscrow.sol";

contract NftEscrow is Auth, INftEscrow {
Copy link
Contributor Author

@lemunozm lemunozm Oct 22, 2024

Choose a reason for hiding this comment

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

I didn't name it RwaEscrow given the Jeroen's comment. I also think collateral at this level is very specific. The escrow is generic enough to handle any NFT through ERC6909, so I called it NftEscrow. Open to more accurate naming

Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure about NFT either. Remember that we discuss supporting fungible tokens in ERC6909 instance as well. Why not call it just Escrow ? Does adding Nft before the name give you any benefit? Do you really care if the item under specific erc6909 and tokenId is an Nft or not ?

Copy link
Contributor Author

@lemunozm lemunozm Oct 26, 2024

Choose a reason for hiding this comment

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

AFAIK, this escrow is only used for those ERC6909 that represents non-fungible tokens.

Copy link
Contributor

Choose a reason for hiding this comment

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

Sure, but if we decide to support fungile tokens then this escrow's name won't be valid and I'm not sure if it matter for NFT to be part of the name of the contract. What's wrong with just escrow ?

Copy link
Contributor Author

@lemunozm lemunozm Oct 28, 2024

Choose a reason for hiding this comment

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

ERC6909 can work with fungible and non-fungible. But NftEscrow can work only for those ERC6909 that are non-fungible. It's like a restriction it adds to the ERC6909 used. Actually, when it locks/attach, it does checks expecting ERC6909 behaves as a non-fungible. So you can not lock 2 different amounts of the same token id from two accounts, something you will expect to do from a fungible escrow.

So it does not support ERC6909 that represents fungibles

Comment on lines +12 to +15
require(source.balanceOf(address(this), tokenId) == 0, AlreadyLocked());

bool ok = source.transferFrom(from, address(this), tokenId, 1);
require(ok, CanNotBeTransferred());
Copy link
Contributor Author

@lemunozm lemunozm Oct 30, 2024

Choose a reason for hiding this comment

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

I want to propose a new entry for our style guidelines, which is not to use mutable calls/actions inside require().

Rationale. From the reader's perspective, require implies a condition, a pre-check. I would not expect to perform any action in the chain or modify some state if I'm requiring something. So I would leave such intention clear and leave the mutable call in another line.

Regarding the performance, I've checked this: https://docs.soliditylang.org/en/latest/internals/optimizer.html#commonsubexpressioneliminator

All subexpressions that are identifiers themselves are replaced by their current value if the value is an identifier.

I think this applies here, so with some minimum optimization level in the compilation phase, the new variable should not add any cost.

Interesting in your thoughts and if you agree on this @wischli @ilinzweilin @peculiarity @hieronx @mustermeiszer

@lemunozm
Copy link
Contributor Author

Ready for review

Copy link
Contributor

@wischli wischli left a comment

Choose a reason for hiding this comment

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

Ultra nit: Some of your natspec docs are terminated with period . and others are not.

@github-actions
Copy link

Coverage after merging feat/rwa-escrow into main will be

81.58%

Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
src
   Auth.sol100%100%100%100%
   NftEscrow.sol100%100%100%100%
src/ERC6909
   ERC6909.sol96.08%85.71%100%100%64–65
   ERC6909Factory.sol100%100%100%100%
   ERC6909NFT.sol93.33%100%75%100%
src/libraries
   MathLib.sol61.64%50%80%62.50%101, 104, 107, 110, 114, 119, 124–129, 135–136, 169, 19–20, 29, 31, 33, 35, 37, 79, 86, 89, 92–93
   StringLib.sol100%100%100%100%

event Unlocked(IERC6909 indexed source, uint256 indexed tokenId);

/// @notice NFT already locked in the escrow.
error AlreadyLocked();
Copy link
Contributor

Choose a reason for hiding this comment

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

Food for thought: Maybe we want to add the IERC6909 source as parameter to all three errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Interesting. My first thought is that if it fails, you know the ERC6909 address / tokenId used when it failed.

I would put in errors only values computed by the method or retrieved from the storage. In this case, I think both can be known because they match the parameters of the method.

But open to listening to others' thoughts regarding this too.

@lemunozm lemunozm enabled auto-merge (squash) November 11, 2024 14:48
@wischli wischli added the ✋ on hold Issue/PR currently on hold label Dec 17, 2024
@lemunozm lemunozm mentioned this pull request Dec 17, 2024
2 tasks
function unlock(IERC6909 source, uint256 tokenId, address to) external auth {
require(source.balanceOf(address(this), tokenId) == 1, NotLocked());

bool ok = source.transferFrom(address(this), to, tokenId, 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note for myself: This is actually:

Suggested change
bool ok = source.transferFrom(address(this), to, tokenId, 1);
bool ok = source.transfer(to, tokenId, 1);

lemunozm pushed a commit that referenced this pull request Feb 20, 2025
* Rewrite UE-2

* fix: actor

* chore: cleanup

* feat: new library

* feat: virtual for ERC7540 tests

* feat: initial progress towards reusable Centrifuge ERC7540 implementation that is also non state impactinf

* feat: progress on ERC7540

* feat: progress on E_3

* fix: compilation

* feat: ERC7540 with reverts halfway done

* feat: all properties to stateless

* feat: admin trophy?

* chore: compilation

* chore: notes

* fix: override unused properties

* chore: cleanup

* fix: toggle back ERC7540

* chore: cleanup

* chore: trophies

* feat: merged delta handling

* chore: brought back ERC7540

* chore: ported out erc7540 logs

* feat: initial debug

* feat: triaged and flagged findings in legit

* feat: property 10

* chore: fmt

* chore: fmt

* feat: initial work on Global-1 and 2

* fix: woops

* feat: ignore ack findings

* fix: incorrect clamp

* fix: linear clamp on remaining orders for decrease

* chore: skip erc7540

* chore: untoggle ERC7540

* feat: admin mistake example

* refactor: make ERC7540 public

* chore: debugging scratchpad

* chore: rename

* feat: more debug

* feat: E_4 broken review

* fix: medusa default sender

* chore: triaage

* feat: broken E_4 second

* chore: notes

* chore: links

* Cleanpu

* chore: debug

* feat: canary 1e6

* fix: properties look ok

* chore: run link

* feat: decimals clamp

* fix: decimals **

* temp: hardcoded decimals

* chore: undo hardcoded decimals

* Round up reduction of maxMint

* feat: extra

* chore: readme

* feat: make ERC7540 Reusable

* chore: docs

* chore: comments

* Add new claim cancel methods

* feat: limit property

* fix: investments

* fix: removed trusted forwarders

* Add properties

* Fix new cancel methods

* Fix properties

* fix: investments

* fix: check for proofs only if > 1

* feat: progress on properties

* feat: recover and dispute recovery

* fix: remove canary

* chore: triage

* fix: calldata = cannot debug

* fix: naming

* fix: traige

* chore: comment

* chore: debug is broken

* fix: clamp to one main sender

* fix: message clamping fixed

* feat: SWE

* chore: debug 15

* fix: compilation and trusted forwarder

* Debug aggregator issues

* Fix properties

* Update

* Round consistently

* Fix max changes

* Cleanup

* Remove file methods

* Check

* Fix

* Fix global 6

* Fix e1 and e2

* More precies clamping

* Clean up

* Fix some tests

* Fix

* Disable property 10

* Disable erc7540-10, add rounding error to erc7540-4, block deposit>maxDeposit

* Format

* Cleanup

* feat: echidna settings

* Dont authTransferFrom to escrow

* Clean up tranche functions

* More cleanup

* Fix

* Fix

* fix: typo

* chore: note on TODO

* Cleanup

* Upgrade solidity

* Fix test compilation

* Fix compilation

* Fix

* Fix gateway

* Fix handlers

* Disable transient opcodes

* Fix setup

* Fix rely

* Update readme

* Fix missing decrease

* Rename

* Clean up existing tests

* Cleanup more old code

* Simplify 7540 properties

* Fix rounding in deposit/redeem

* Remove unnecessary log

* Add scope doc

* Fix forced authTransferFrom

* Rename

* Move transfer check to vault

* Fix max checks

* Fix tests

* Adapt property 9

* Re-enable transient storage

* Re-enable cancun

* Update scope

* Allow claiming 0

* Add if statements

* Rename and move

* Fix echidna in ci

* Add forge build to echidna commands

* Remove old invariant tests

* Fix interface name

* Basic investment mgr docs

* Clarify

* chore: Change the way initial ward is set

* chore: Gas optimization by caching array length in array iteration (#14)

* chore: Gas optimization by caching array length in array iteration

* chore: Rename variable

* chore: Fix formating

* fix: Remove unnecessary inheritance that is breaking compilation

* chore:(finding-21) Make stricter check when parsing batch messages (#18)

* chore:(finding-14) Replace _initiator() with msg.sender (#17)

* chore:(finding-14) Replace _initiator() with msg.sender

* chore: Remove completely _initiator()

* chore:(finding-3) Rename balances state variable to reflect the metadata it cont… (#11)

* chore: Rename balances state variable to reflect the metadata it contains in its bits

* chore: Change balance book-keeping for the tranch token

* chore: Fix format issues

* chore: Renaming field and removing unnecessary code

* chore: One more renaming

* chore: More improvements

* chore: Fix liniting

* chore: Fix weird formatting that appears on save

* fix: Gateway.estimate had mismatched local variables (#23)

* chore:(finding-24) Safely cast uint256 to uint8 (#19)

* chore:(finding-24) Safely cast uint256 to uint8

* Fix linting issues

* chore: Add unit tests for MathLib.toUint8()

* chore:(finding-19) Add a view method to allow user to see if they can execute their deposit requests (#16)

* chore:(finding 19) Add a view method to allow user to see if they can execute their deposit requests

* rename parameter

* chore: Rename function

* chore:(finding-2) Remove unnecessary interface declaration (#12)

* chore: Remove unnecessary itnerface declaration

* chore: Clean up all *Like interface definitions and usages

* chore: Add missing documentation

* chore: Change wording

* chorel: Fix linting

* fix: findings #8, #27, #38, #49, #53, #56, #65, #66, #68 (#24)

* Uses variable name tranches is confusing #56

* updateRestriction could try to call non existing hook #53

* No vault level emit for triggerRedeemRequest #49

* Slot name could lead to collisions #68

* Unnecessary typecast in concat #66

* Comment in fulfillDepositRequest() seems incorrect #38

* Could use safeTransferETH() #27

* Very low number of minimal decimals #8

* byAdapter => perAdapter #56

* Fix interface #56

* Add comment

* Assets can get stuck in TransferProxy #77 (#27)

* Fix transfer proxy

* Add tests

* Add recovery to proxy

* Finding 64, 57 (#29)

* consolidate licenses

* Use constant instead of 8

* fix:(finding-40) Calling PoolManager.transferTrancheTokens call directly tranche burn without checking for any restrictions (#26)

* fix: Calling PoolManager.transferTrancheTokens call directly tranche.burn without checking for any restrictions

* chore: Add hook for each tranche burn

* Remove unnecessary check

* Fix linting issue

* Remove unnecessary method

* chore:(finding-33) User wrapped token amount if it is possible when calling openLockDepositRequest, otherwise use underlying asset if possible to wrap it (#22)

* (#34) Check that vault is valid on `getVault()` (#25)

* Check vault exists in getVault

* add more tests

* Format

---------



* Updating set of active adapters does not always clear votes #78 (#32)

* Updating set of active adapters does not always clear votes #78

* Cleanup

* Format

* chore:(finding-70) Improve documentation (#34)

* Fixing findings #45 , #48, #76 (#33)

* chore:(finding-45) Optimize by caching values

* chore: Remove unnecesary variable

* fix:(finding-76) Cannot request deposit cancelation if you don't have any pending deposit requests

* chore:(finding-48) Add documentation for fulfillment param in fulfillCancelRequestDeposit

* chore: Improve documentation

* chore: Move documentation

* fix:(finding-76) Allow calling cancelReedemRequest only if there are any pending redeem requets

* Limit owner in `requestDeposit/Redeem`, extend` open()` docs (#36)

* Limit owner, add comment

* Update tests

* Add validate controller method

* Fix comments

* Update

* Enable/disable

* isOpen => isEnabled

* chore:(finding-10) Replace hardcoded value (#35)

* chore:(finding-10) Replace hardcoded value

* Replace comment

* chore:(finding-83) Replace non-transferable with non-fungible

* Require price to be set (#31)

* Require price to be set

* Fix test

* chore: Remove redundant check (#38)

* Remove unused import (#39)

* chore: Optimize gateway (#42)

* Fixes #4, #85, #88 (#40)

* Swap order

* Swap deadline/nonce

* manager => investmentManager

* Any tokens left in CentrifugeRouter can be used by anyone#4

* Undo

* Initializing with 0 isn't necessary if the variable is also defined in the for loop#88

* fix: Unnecessary authorization (#43)

* fix: Unnecessary authorization

* Fix deployment test

* Improve testing the deployer script

* Fixes set operator, #37, #95, #97, #98, #100, #103, #104, #108, #109, #111 (#45)

* Block setting self as operator

* Use _maxDeposit

* Remove encodePacked

* Simplify transfer check

* Remove unused method

* Clean up checkERC20Transfer

* Update src/token/RestrictionManager.sol



* Update src/token/RestrictionManager.sol



* Cleanup

* Update src/token/RestrictionManager.sol



* ExecuteMessage event

* Unsued imports

* 95

* Several more fixes

* Comment

* Format

* Add test for max message id

* Consistent storage

* Fix test

* Remove vault asset id

* Test authorize operator

* Endorsed operator test

* Disable crytic foundry tests for now

* Revert gas service change

* Execute message event

* Change getVault

* Add isPoolActive

* Move address zero check

* Clarify gateway events

* Change deployTranche

* Update InvestmentState order

---------



* feat: Introduce toppers mapping which are the only allowed addresses … (#46)

* feat: Introduce toppers mapping which are the only allowed addresses to call topUp().

* chore: Rename variable

* chore: Remove unused code

* chore: Change state vars order

* chore: Change wording in revert message

* fix: Test

* chore: Remove unused import in TransferProxyFactory (#53)

* chore: Rename transferAsset to avoid confusion (#50)

* fix: Missing filing in deployment script (#47)

* chore: Make Auth abstract (#52)

* chore: Cache reading array length (#56)

* chore: Improve comment (#51)

* chore: Improve comment

* fix: Comment format

* CREATE2 transfer proxy (#55)

* Use create2 for transfer proxy

* Format

* Add file test

* Format

* Change escrow salt

* Format

* chore: Use plain bit shift operations (#57)

* chore: Add shiftRight to BitmapsLib

* chore: Use plain bit shifting operations

* Add methods to predict CREATE2 addresses (#58)

* Fix #5, #47 (#59)

* Fix #5

* Fix #47

* Add test check (#60)

* Formt

---------



* Fix comment (#61)

* Make transfer proxy factory deployment deterministic

* fix: Initial changes to make fork tests verifiable again

* chore: Make deployment verifiable via fork

* Improve fork tests

* Update base config

* Adapt for base

* Add arbitrum

* Add ethereum mainnet

* Add celo

* Add a few more sanity checks

* Update README

* Update README.md

* Update README.md

* Compress pdfs

* Add test for determinism

* Comments

* Error messages

* Remove restriction manager verification

* Disable determinism tests

* Format

* Clean up invariant test code

---------

Co-authored-by: Alex The Entreprenerd <alex@entreprenerd.xyz>
Co-authored-by: John <bulk.yard@protonmail.com>
Co-authored-by: Adam Stox <AStox@users.noreply.github.com>
@mustermeiszer
Copy link
Contributor

Closing for now

auto-merge was automatically disabled March 27, 2025 14:04

Pull request was closed

hieronx added a commit that referenced this pull request May 21, 2025
# This is the 1st commit message:

Add author

# This is the commit message #2:

Remove unused

# This is the commit message #3:

Add base decoder

# This is the commit message #4:

Add vault decoder

# This is the commit message #5:

Rename

# This is the commit message #6:

Cleanup

# This is the commit message #7:

Add interface

# This is the commit message #8:

Start working on tests

# This is the commit message #9:

Work on tests

# This is the commit message #10:

Change

# This is the commit message #11:

Add approval

# This is the commit message #12:

Fix

# This is the commit message #13:

Fix warnings

# This is the commit message #14:

Rename, add test

# This is the commit message #15:

Add manager deployment

# This is the commit message #16:

Remove factory

# This is the commit message #17:

Add methods to reset the price overrides (#375)

* Add methods to reset the price overrides

* Remove unused imports

* Update src/vaults/BalanceSheet.sol

Co-authored-by: William Freudenberger <w.freude@icloud.com>

---------

Co-authored-by: William Freudenberger <w.freude@icloud.com>
# This is the commit message #18:

Rename vaults to spokes, decouple vault managers and implementations (#377)

* Rename vaults to launchpad, move token

* Move vaults

* Rename to spokes

* Fix

* Remove manager dependencies from pool manager
# This is the commit message #19:

Fix `sliceZeroPadded` (#376)

* Fix sliceZeroPadded

* Cleanup

* Fix overflow error

* Fix
# This is the commit message #20:

Remove ERC20 wrapping feature (#380)

* Remove ERC20 wrapping feature

* Fix warnings
# This is the commit message #21:

Reset price in managers after overrides (#382)

* Add reset price calls

* Snapshots
# This is the commit message #22:

Fix licenses (#383)


# This is the commit message #23:

Rename `PoolManager` to `Spoke`

# This is the commit message #24:

Modify index from MessageProofId (#381)

* modify index of proof message id

* add comment
# This is the commit message #25:

Make test work

# This is the commit message #26:

MultiAdapter (#372)

* base implementation

* apply comments

* fix tests

* fix tests

* renames

* minor rename

* fix

* rename to entrypoint and missing doc refs

* adapters interfaces in its own folder

* minor rename

* apply comments

* Helper organization

* fix legacy test failing

* factorize addUnpaidMessage
# This is the commit message #27:

custom message for updating the BSM (#387)


# This is the commit message #28:

Pass tokenWards directly to the factory once. (#390)

* Pass wards once direclty in the tokenFactory

* fix tests
# This is the commit message #29:

Fix: Correct check before disputeRecovery (#391)

* correct check before dispute recovery

* rename var
# This is the commit message #30:

Missing renames from Vaults to spoke (#388)

* VaultsDeployer and related to SpokeDeployer

* docs folder rename
# This is the commit message #31:

paths spokes to spoke (#389)


# This is the commit message #32:

Add metadata

# This is the commit message #33:

ref: improve pricing precision (#392)

* ref: improve precision of pricing calc

* tests: improve precision for roundtrip tests

* chore: revert on zero reciprocal price

* tests: add and improve edge cases, split up tests further
# This is the commit message #34:

Ref: UpdateVault as independent message (#394)

* make UpdateVault an independent message

* fix comment
# This is the commit message #35:

Add token & vault update methods (#393)

* Set up token update methods

* Fix missing slash

* Remove unused imports

* Snapshots
# This is the commit message #36:

fix transferShares issue & some minor refactors (#396)


# This is the commit message #37:

Add struct

# This is the commit message #38:

Use struct in tests

# This is the commit message #39:

Factorize merkle tree lib
@hieronx hieronx deleted the feat/rwa-escrow branch May 25, 2025 14:18
hieronx added a commit that referenced this pull request Jun 18, 2025
* Add merkle proof manager

* # This is a combination of 39 commits.
# This is the 1st commit message:

Add author

# This is the commit message #2:

Remove unused

# This is the commit message #3:

Add base decoder

# This is the commit message #4:

Add vault decoder

# This is the commit message #5:

Rename

# This is the commit message #6:

Cleanup

# This is the commit message #7:

Add interface

# This is the commit message #8:

Start working on tests

# This is the commit message #9:

Work on tests

# This is the commit message #10:

Change

# This is the commit message #11:

Add approval

# This is the commit message #12:

Fix

# This is the commit message #13:

Fix warnings

# This is the commit message #14:

Rename, add test

# This is the commit message #15:

Add manager deployment

# This is the commit message #16:

Remove factory

# This is the commit message #17:

Add methods to reset the price overrides (#375)

* Add methods to reset the price overrides

* Remove unused imports

* Update src/vaults/BalanceSheet.sol

Co-authored-by: William Freudenberger <w.freude@icloud.com>

---------

Co-authored-by: William Freudenberger <w.freude@icloud.com>
# This is the commit message #18:

Rename vaults to spokes, decouple vault managers and implementations (#377)

* Rename vaults to launchpad, move token

* Move vaults

* Rename to spokes

* Fix

* Remove manager dependencies from pool manager
# This is the commit message #19:

Fix `sliceZeroPadded` (#376)

* Fix sliceZeroPadded

* Cleanup

* Fix overflow error

* Fix
# This is the commit message #20:

Remove ERC20 wrapping feature (#380)

* Remove ERC20 wrapping feature

* Fix warnings
# This is the commit message #21:

Reset price in managers after overrides (#382)

* Add reset price calls

* Snapshots
# This is the commit message #22:

Fix licenses (#383)


# This is the commit message #23:

Rename `PoolManager` to `Spoke`

# This is the commit message #24:

Modify index from MessageProofId (#381)

* modify index of proof message id

* add comment
# This is the commit message #25:

Make test work

# This is the commit message #26:

MultiAdapter (#372)

* base implementation

* apply comments

* fix tests

* fix tests

* renames

* minor rename

* fix

* rename to entrypoint and missing doc refs

* adapters interfaces in its own folder

* minor rename

* apply comments

* Helper organization

* fix legacy test failing

* factorize addUnpaidMessage
# This is the commit message #27:

custom message for updating the BSM (#387)


# This is the commit message #28:

Pass tokenWards directly to the factory once. (#390)

* Pass wards once direclty in the tokenFactory

* fix tests
# This is the commit message #29:

Fix: Correct check before disputeRecovery (#391)

* correct check before dispute recovery

* rename var
# This is the commit message #30:

Missing renames from Vaults to spoke (#388)

* VaultsDeployer and related to SpokeDeployer

* docs folder rename
# This is the commit message #31:

paths spokes to spoke (#389)


# This is the commit message #32:

Add metadata

# This is the commit message #33:

ref: improve pricing precision (#392)

* ref: improve precision of pricing calc

* tests: improve precision for roundtrip tests

* chore: revert on zero reciprocal price

* tests: add and improve edge cases, split up tests further
# This is the commit message #34:

Ref: UpdateVault as independent message (#394)

* make UpdateVault an independent message

* fix comment
# This is the commit message #35:

Add token & vault update methods (#393)

* Set up token update methods

* Fix missing slash

* Remove unused imports

* Snapshots
# This is the commit message #36:

fix transferShares issue & some minor refactors (#396)


# This is the commit message #37:

Add struct

# This is the commit message #38:

Use struct in tests

# This is the commit message #39:

Factorize merkle tree lib

* Add author

Remove unused

Add base decoder

Add vault decoder

Rename

Cleanup

Add interface

Start working on tests

Work on tests

Change

Add approval

Fix

Fix warnings

Rename, add test

Add manager deployment

Remove factory

Add methods to reset the price overrides (#375)

* Add methods to reset the price overrides

* Remove unused imports

* Update src/vaults/BalanceSheet.sol

Co-authored-by: William Freudenberger <w.freude@icloud.com>

---------

Co-authored-by: William Freudenberger <w.freude@icloud.com>

Rename vaults to spokes, decouple vault managers and implementations (#377)

* Rename vaults to launchpad, move token

* Move vaults

* Rename to spokes

* Fix

* Remove manager dependencies from pool manager

Fix `sliceZeroPadded` (#376)

* Fix sliceZeroPadded

* Cleanup

* Fix overflow error

* Fix

Remove ERC20 wrapping feature (#380)

* Remove ERC20 wrapping feature

* Fix warnings

Reset price in managers after overrides (#382)

* Add reset price calls

* Snapshots

Fix licenses (#383)

Rename `PoolManager` to `Spoke`

Modify index from MessageProofId (#381)

* modify index of proof message id

* add comment

Make test work

MultiAdapter (#372)

* base implementation

* apply comments

* fix tests

* fix tests

* renames

* minor rename

* fix

* rename to entrypoint and missing doc refs

* adapters interfaces in its own folder

* minor rename

* apply comments

* Helper organization

* fix legacy test failing

* factorize addUnpaidMessage

custom message for updating the BSM (#387)

Pass tokenWards directly to the factory once. (#390)

* Pass wards once direclty in the tokenFactory

* fix tests

Fix: Correct check before disputeRecovery (#391)

* correct check before dispute recovery

* rename var

Missing renames from Vaults to spoke (#388)

* VaultsDeployer and related to SpokeDeployer

* docs folder rename

paths spokes to spoke (#389)

Add metadata

ref: improve pricing precision (#392)

* ref: improve precision of pricing calc

* tests: improve precision for roundtrip tests

* chore: revert on zero reciprocal price

* tests: add and improve edge cases, split up tests further

Ref: UpdateVault as independent message (#394)

* make UpdateVault an independent message

* fix comment

Add token & vault update methods (#393)

* Set up token update methods

* Fix missing slash

* Remove unused imports

* Snapshots

fix transferShares issue & some minor refactors (#396)

Add struct

Use struct in tests

Factorize merkle tree lib

Fix warnings

Add author

Remove unused

Add base decoder

Add vault decoder

Rename

Cleanup

Add interface

Start working on tests

Work on tests

Change

Add approval

Fix

Fix warnings

Rename, add test

Add manager deployment

Remove factory

Add methods to reset the price overrides (#375)

* Add methods to reset the price overrides

* Remove unused imports

* Update src/vaults/BalanceSheet.sol

Co-authored-by: William Freudenberger <w.freude@icloud.com>

---------

Co-authored-by: William Freudenberger <w.freude@icloud.com>

Rename vaults to spokes, decouple vault managers and implementations (#377)

* Rename vaults to launchpad, move token

* Move vaults

* Rename to spokes

* Fix

* Remove manager dependencies from pool manager

Fix `sliceZeroPadded` (#376)

* Fix sliceZeroPadded

* Cleanup

* Fix overflow error

* Fix

Remove ERC20 wrapping feature (#380)

* Remove ERC20 wrapping feature

* Fix warnings

Reset price in managers after overrides (#382)

* Add reset price calls

* Snapshots

Fix licenses (#383)

Rename `PoolManager` to `Spoke`

Modify index from MessageProofId (#381)

* modify index of proof message id

* add comment

Make test work

MultiAdapter (#372)

* base implementation

* apply comments

* fix tests

* fix tests

* renames

* minor rename

* fix

* rename to entrypoint and missing doc refs

* adapters interfaces in its own folder

* minor rename

* apply comments

* Helper organization

* fix legacy test failing

* factorize addUnpaidMessage

custom message for updating the BSM (#387)

Pass tokenWards directly to the factory once. (#390)

* Pass wards once direclty in the tokenFactory

* fix tests

Fix: Correct check before disputeRecovery (#391)

* correct check before dispute recovery

* rename var

Missing renames from Vaults to spoke (#388)

* VaultsDeployer and related to SpokeDeployer

* docs folder rename

paths spokes to spoke (#389)

Add metadata

ref: improve pricing precision (#392)

* ref: improve precision of pricing calc

* tests: improve precision for roundtrip tests

* chore: revert on zero reciprocal price

* tests: add and improve edge cases, split up tests further

Ref: UpdateVault as independent message (#394)

* make UpdateVault an independent message

* fix comment

Add token & vault update methods (#393)

* Set up token update methods

* Fix missing slash

* Remove unused imports

* Snapshots

fix transferShares issue & some minor refactors (#396)

Add struct

Use struct in tests

Factorize merkle tree lib

Fix warnings

* Remove unused import

* Update README

* Implement update contract for policy updates

* Cleanup

* Rename

* Add strong typing for calls

* Fix warning

* Reorganize tests

* Implement ERC7751

* Add failure tests

* Event order

* Add Circle decoder

* Fix warnings

* Change update contract to only be callable by spoke

* Check pool id coming from spoke

* Remove unused deployer param

* Use require statement

* Remove unused imports

* Add methods for claiming cancelations

* Remove unused imports

* Format

* Add factory

* Remove balance sheet dependency

* Add check unused imports script

* Add unused import as test

* Add failure code

* Remove unused import

* ci: add import checks (#455)

* feat: add --check-order to import script, ignore cached/out files

* ci: add import checks

* fix: imports for Merkle

* Remove check-unused-imports

* Add manuel's may report

* Update license

* Add version numbers

* Add 3rd burraSec report

* Start to fix PR feedback

* Format

* Update natspec

* Update order

* chore: remove unused

---------

Co-authored-by: William Freudenberger <w.freude@icloud.com>
wischli pushed a commit that referenced this pull request Jan 20, 2026
wischli added a commit that referenced this pull request Feb 17, 2026
* Improve anvil deployment with dual-fork support

* Refactor AnvilManager to use structured account data and improve key management

* Enhance deployment error handling and configuration updates

* Refactor deploy script to enhance deployment steps and validation
- Updated argument validation to support new deployment steps and improved error handling.
- Enhanced wiring logic for adapters, including support for multiple connected networks.

* add cross-chain tests to deploy.py

* latest testnets deployment

* Update deploy script and crosschain validation for contract naming conventions

- Changed backward compatibility check in deploy.py from "release:sepolia" to "deploy:testnets".
- Updated contract names in crosschain.py to use lowercase for consistency.
- Added logic in WireAdapters.s.sol to skip deployment if the deploy flag is set to false.

* update cross-chain readme (AI)

* change deploy to deploy to all testnets

* standardize deploymentInfo

* Refactor deployment steps in deploy.py and related files

- Updated deployment step names from "deploy:testnets" to "deploy:all" for consistency.
- Changed references from "deploy:protocol" to "deploy:full" to align with new deployment structure.
- Adjusted user prompts and validation messages to reflect the updated command usage.
- Ensured backward compatibility for the new deployment step naming.

* fix: discover pool & share tokens on spoke

* fix: trigger refund escrow deploy in spoke script if missing

* rewire for arbitrum-sepolia Axelar adapter

* run dry-run when PR changes for deploy testnsets

* Refactor deployment steps in deploy.py and related files

- Updated deployment step from "deploy:all" to "deploy:testnets" for clarity and consistency.
- Implemented dry-run mode to skip verification and state saving during test deployments.

* redeploy and re-wire adapters

* Enhance deployment validation and handling

- Added early network validation in load_config.py to prevent loading .env values if a network mismatch is detected.
- Updated deploy.py to normalize the step for the special case of deploying to testnets.
- Improved runner.py to skip verification in dry-run mode with appropriate messaging.

* feat: v3.1 Spell Validator PoC (#16)

* deploy fixes (#14)

* add setEpochIds to use in the migration (#21)

* deployment changes to support the migration (#22)

* fix import script when name is after ../ (#25)

* Spell: Migration v3.1 MVP (without pre- and post-validation) (#15)

* base implementation

impl almost complete

add BRM and split in two spells

protect calls

migrate PoolEscrow

organize spell

draft next steps

add script and test structure

more correct setup

minor changes

minor changes

more dubugging process

move validationf files to validation folder

fix

fixes

fix version

deployment changes

working preview address

remove check

parameterize deployer address in Deployer contract

use registerPool

remove manual process to ensure no outstanding orders

test passing but without indexing data

retrieve the hubPools from indexer

more indexer data and fixes

* fix subsidizing issue

* correct refunding

* correct refunding assuming no escrow used in spoke side

* fixes and more support

* onOfframp indexer requests

* link vaults correctly and fix bs managers

* filtered assets and centrifugeIds

* fix imports

* correclty process for unexisting poolIds in that chain

* fix asset treatment

* fix import

* tested for all chains working

* add spell lock post-check

* discard all spell test from CI

* fix spelling

* minor changes from review

* fix spelling

* fix coverage

* fix anvil

* fix: hook address mismatch (#30)

* Migration: testnet support (#29)

* testnet support

* Add patch to suppor the non-existence of freelyTransferibleHook in testnets

* migration fixes

* custom pools by input

* add pool for testnet

Signed-off-by: lemunozm <lemunozm@gmail.com>

* fix spelling

---------

Signed-off-by: lemunozm <lemunozm@gmail.com>

* Migration: rely steps for root in migration phase (#32)

* rely steps for root in migration

* add deployer for the migration

* deploy with blocked registerAsset and fix it in the spell

* simplify migration script

* unify migration spells into just one

* disable spell

* fix imports

* apply comments

* Fix: Gateway unpaid reentrancy issue (#38)

* fix gateway unpaid reentrancy issue

* fix benchmarks

* Add check to registerAsset for readability (#33)

* add poolId and scId check to registerAsset

* update gas values

* erc6909 support (#40)

* Migration: testnet anvil fork test (#37)

* add script and required changes

* move testnet scripts under scripts

* a bit organization improvement

* improve script to support anvil-fork and testnet at the same time

* update json files to be able to wire correctly

* update jsons

* update spelling

* minor

* fix import

* fix paths

* uncomment verify mainnet lines

* Force pool adapters (#28)

* force pool adapters

* fix failing tests and simplify 3ChainsEndToEnd

* gas values

* remove messageSourceCentrifugeId

* fix benchmarks

* add comment

* update comment

Signed-off-by: lemunozm <lemunozm@gmail.com>

* fix imports

* apply gas values

---------

Signed-off-by: lemunozm <lemunozm@gmail.com>

* fix: update shared testnet account in config loading

* upload contract addresses

* verify script

* feat: add isolated cross-chain adapter script

* ref: deprecate previous cross-chain testnet scripts

* add asset protection

* add comment

* fix adapters from spoke side

* modify how adapter info is gathered and the valuator

* ensure post-validation order

* fix import

* add support for adapters that are not enabled in some chains

* use 2/3 for all adapters, never deploy wormhole

* wip: enable chainlink isolated tests

* feat: add cheaper & simpler isolated adapter test (co-existence)

* Script: verifies contract from factories automatically (#135)

* add the base script process

* add the constructor args

* get constructor args in a more solidity way

* use latest etherscan endpoint

* remove unused stuff

* add support for plume

* support checking contracts from other versions

* use rpc composer

* fix import

* reorganize

* fix

* update mainnet graphQL endpoint

* adapt to latest indexer endpoint

* recompose constructorArgs by reading the contracts

* add beautiful colors

* fetch in inverse order

* fix imports

* Add v3.1 audit reports (#762)

* Add deployment verification report (#763)

* script: minor improvements

* fmt

* ref: cleanup, rm v1 of isolated tests

* chore: rm env changes (probably outdated at this point)

* add crosschain test orchestration (ported from protocol-internal PR #13)

Adds CrossChainTestManager used by deploy.py for crosschaintest:hub
and crosschaintest:spoke steps. Was missing from the branch despite
deploy.py already importing it.

* fix: update AnvilEnv initialization to include network parameters

Modified the AnvilManager class to pass additional parameters (network_name, port, dst_cfg, chain_id) to the AnvilEnv constructor, enhancing its configuration capabilities.

* feat: enhance cross-chain test orchestration in deploy.py

Updated the CrossChainTestManager to support a full 4-step cross-chain test sequence, including asset registration, hub setup, relay waiting, and share class testing. Added new command options for streamlined execution and improved documentation in README.md for clarity on usage. Adjusted argument parsing to include new test phases.

* chore: sync crosschain & readme

* docs: rm hardcoded addresses

* refactor: create arbitrum-sepolia anvil env file before hand

Consolidated the creation of environment files for Sepolia and Arbitrum Sepolia in the AnvilManager class. This change ensures both environment files are created upfront

* fix: resolve anvil dual-fork deploy failures

- Override protocolAdmin/opsAdmin in anvil env with anvil account
  addresses so OpsGuardian/ProtocolGuardian accept calls from the
  deployer (fixes NotTheAuthorizedSafe)
- Remove stray undefined `verifier` reference (would crash with
  NameError)
- Use --disable-block-gas-limit for anvil forks (Arbitrum gas model
  inflates estimates beyond any fixed limit)
- Remove redundant WireAdapters step (FullDeployer already wires
  adapters during deploy:full)
- Fix verification to extract address from contract entry dict
  (was passing the full {address, blockNumber, txHash} object)

---------

Signed-off-by: lemunozm <lemunozm@gmail.com>
Co-authored-by: Guillermo Perez <gpmayorga@users.noreply.github.com>
Co-authored-by: Luis Enrique Muñoz Martín <lemunozm@gmail.com>
Co-authored-by: Jeroen <1748621+hieronx@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

✋ on hold Issue/PR currently on hold

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants