-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: Add price
field to AddTranche
#33
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Something is off either in Solidity or on the cent-chain as the encoded AddTranche messages are not matching across the two sides. On solidity we get 217 byte-long messages which seems correct but nothing seems apparently wrong in the Rust side.
hieronx
approved these changes
Jan 31, 2023
NunoAlexandre
added a commit
that referenced
this pull request
Feb 9, 2023
* add withdraw & deposit * make withdraw function public * add sendMessages to router * update deploy script and add test * switch Nomad to XCM router in tests * add happy case deposit & withdraw tests * remove unused code * add xAppConnectionManager * add assertions for withdraw happu case * add edges cases for transfer route * add edge case tests for transferTo * remove misleading messages * remove misleading messages * update origin address * Use correct checksummed origin address * Strip out nomad and testing dependencies from XCMRouter. Add ping function for testing. * Update router * fix naming * Update centrifuge origin address * fix updateMember parsing * roll back updateMember change * Clean up * forge install: memview-sol * Fix all the tests * Fix deps * Remove yarn steps from workflows * Remove deploy test * Remove nomad router's send message logic and tests pertaining to it * Fix memview-sol branch submodule not found * Drop "== true" blocks * Fix `UpdateMember` encoding & decoding (#32) * Fix 9-24: trancheId (16 bytes) docs * feat: Add `price` field to `AddTranche` (#33) * Make `UpdateTokenPrice.price` and `Tranche.latestPrice` `u128` (#34) * Use cent-chain AddTranche message Use a cent-chain generated message to test AddTranche encoding and decoding functions. * Align tests with cent chain (#36) * Use cent-chain generated UpdateMember for decoding * Drop toBytes16 * Chore/add tests and optimizations (#38) * wip: add transfer test * move memberlist check from connectors to restricted token * fix tests * revert restricted.sol changes * revert unwanted changes to erc20 and memberlist * fix test * Feat/domain update (#35) * remove domainLookup * require destination domain to be cent chain * fix tests * clean up * fix up * rename Domains to Domain * Add new domain lookup * update domain enum * move formatDomain to messages.sol * fix tests * update enum and domain encoding * update domain encoding to output bytes9 * Update src/Connector.sol * update domain encoding and add more tests --------- Co-authored-by: Jeroen Offerijns <[email protected]> * Fine-tune transfers encoding, decoding, and tests (#39) * Fix transfer encoding / decoding We need to encode address as 32 bytes and take in consideration when decoding. Also, amount should be encoded as a u128. * Fix transfer decoding * Cover transfer to centrifuge * Fix docs - thanks @AStox * Add TODO and more tests * Update test/Connector.t.sol --------- Co-authored-by: Adam Stox <[email protected]> Co-authored-by: Jeroen Offerijns <[email protected]> Co-authored-by: nuno <[email protected]> Co-authored-by: Adam Stox <[email protected]> Co-authored-by: Jeroen Offerijns <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We add a
price
field to theAddTranche
message which represents the price of the tranche token being added at that specific moment in time.Internally, this value - and
UpdateTokenPrice.price
- is stored asTranche.latestPrice
. That struct field hasu256
as its type, which is not compatible with the Cent-Chain side where a tranche price is typed asRate(u128)
.u128
encodes to16 bytes
whileu256
encodes to32 bytes
. For that reason, to make both sides compatible, we parse and encodeprice
as au128
but keep the internal storage type asu256
for now.Note: we will need to also apply this described parsing approach to
UpdateTokenPrice
in a follow up PR.