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

feat(station)!: multi chain support #374

Open
wants to merge 20 commits into
base: main
Choose a base branch
from
Open

Conversation

olaszakos and others added 12 commits September 3, 2024 12:42
In this PR:
- add Asset repository
- add Asset model validation
- add validation
- remove static asset list
- add ICP asset at init_canister step

---------

Co-authored-by: Kepler Vital <[email protected]>
Add asset management UI:
- assets page
- asset create/edit dialog
- asset request operation components
- UI tests

Limitations / known issues:
- Standards autocomplete picker shows the code vs. the localized name of
the standard.
- new Accounts are created for ICP, even if another asset is selected,
thats because it is hard coded currently

---

Added to the sidebar:
<img width="333" alt="image"
src="https://github.com/user-attachments/assets/9ec840ba-c105-44f5-89ec-442cbbb4c4f8">

Assets page:
<img width="1312" alt="image"
src="https://github.com/user-attachments/assets/904e00b9-fbed-48b5-b091-9fc3a37b7164">

Add new asset:
<img width="908" alt="image"
src="https://github.com/user-attachments/assets/5cab6d89-da51-4f1a-a6c5-e5c8c56b02c6">

Edit asset:
<img width="917" alt="image"
src="https://github.com/user-attachments/assets/6acb7cb8-d712-4dda-8f43-14dfd1352e9c">

Peding edit request:
<img width="1301" alt="image"
src="https://github.com/user-attachments/assets/8ed708f1-4f17-4adb-8b94-b6aee5511333">

Peding edit request details:
<img width="905" alt="image"
src="https://github.com/user-attachments/assets/a2fc01dd-e258-4278-ae40-fa282157a93f">

---------

Co-authored-by: Kepler Vital <[email protected]>
Disabled checks:
- Frontend validation
- Migration tests

---------

Co-authored-by: mraszyk <[email protected]>
Co-authored-by: Kepler Vital <[email protected]>
This PR adds ICRC-1 support for the station.

Adding the default ICP asset to an account now generates 2 addresses for
the account: AccountIdentifier and ICRC-1 Account. They reference the
same account in the ICP ledger.
Todo:
- [x] add frontend tests
- [x] update locales
- [x] remove duplicated account name
- [x] make index canister optional and display a warning when
transactions cannot be loaded if it's missing
- [x] fix icrc1 address shortening ...c0337e7f4d424...dec70df...
- [x] unify address display across the frontend 
- [x] account page Requests button should filter for Accounts
- [x] fix notification error -- `was local dev issue with unmigrated
account`
- [x] disallow removing an asset if any accounts reference it
- [x] localize assets page standards
- [x] fix edit account request views
- [x] restore ICP/ICRC1 asset creation custom form fields

POST MVP:
- [ ] show fee at transfer
  - [ ] add icrc1/icp ledger interfaces to UI (dfx generate)
  - [ ] fetch when the dialog is displayed

---------

Co-authored-by: Kepler Vital <[email protected]>
### STATION
1. [x] create ICP asset and set up asset management permissions and
policies
2. [x] migrate models:
	- [x] Account
		- remove `blockchain`
		- remove `address`
		- remove `standard`
		- remove `symbol`
		- remove `decimals
		- remove `balance`
		- add `seed`
		- add `assets`
		- add `addresses`
	- [x] Transfer
		- add from_asset
		- add with_standard
	- RequestOperation
		- [x] EditAccount
			- add `change_assets`
		- [x] TransferOperation
			- add `asset`
		- [x] TransferOperationInput
			- add `from_asset_id`
			- add `with_standard`
		- [x] AddAccountOperationInput
			- add `assets`
			- remove `blockchain`
			- remove `standard`
		- [x] AddAddressBookEntryOperationInput
			- add address_format
	- [x] AddressBookEntry
		- add address_format
3. [x] update integration tests
4. [x] add snapshot generation test

### UPGRADER:
1. [x] ~migrate accounts~ support both old and new model
2. [x] update DR spec

---------

Co-authored-by: Kepler Vital <[email protected]>
@olaszakos olaszakos marked this pull request as ready for review October 31, 2024 14:32
@olaszakos olaszakos requested a review from a team as a code owner October 31, 2024 14:32
apps/wallet/package.json Outdated Show resolved Hide resolved
core/station/impl/src/models/asset.rs Outdated Show resolved Hide resolved
core/station/impl/src/models/indexes/unique_index.rs Outdated Show resolved Hide resolved
core/station/impl/src/models/address_book.rs Show resolved Hide resolved
core/station/impl/src/errors/asset.rs Outdated Show resolved Hide resolved
core/station/impl/src/core/validation.rs Outdated Show resolved Hide resolved
core/station/impl/src/core/init.rs Show resolved Hide resolved
apps/wallet/src/pages/AccountAssetPage.vue Outdated Show resolved Hide resolved
olaszakos and others added 2 commits November 5, 2024 18:47
Addressing the following tickets:
1. [x] [Transfer form should keep transfer btn disabled if address
format is invalid](https://dfinity.atlassian.net/browse/PEN-335)
2. [x] [Add assets dashboard
page](https://dfinity.atlassian.net/browse/PEN-337)

New dashboard page: 

![image](https://github.com/user-attachments/assets/353b34d4-7b1e-458f-8639-ea2b951feaae)

---------

Co-authored-by: Kepler Vital <[email protected]>
/// The account id, which is a UUID.
pub type AccountId = UUID;
pub type AccountSeed = UUID;

/// Represents a account in the system.
///
/// A account can be associated with one or more users and can only hold one type of asset,

Choose a reason for hiding this comment

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

Comment is no longer accurate.

olaszakos and others added 6 commits November 19, 2024 18:32
Problem:

1. The station syncs all assets and accounts to the upgrader on any
account and asset change. The accounts change on each balance query
since the new balance is saved back to the repository. This results in
very frequent unnecessary syncs.
2. The upgrader log size is growing rapidly. Trimming is necessary, but
it cannot be trimmed due to the stable Log structure only supporting
append operation.

Task:
1. [x] only sync assets and accounts when the change is relevant - ie.
any field of the DR version of the entries change
2. [x] switch to a stable BTreeMap to keep the logs and limit the log
size to 25k items

Also bundled a small fix for a missing asset foreign key check.

---------

Co-authored-by: Kepler Vital <[email protected]>
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.

3 participants