Skip to content

feat(mound): add contract articles import functionality #299

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

Closed
wants to merge 9 commits into from

Conversation

astral-bitlight
Copy link

This PR introduces a new import_articles function to the DirMound implementation, allowing for the import of contract articles from external files.

@astral-bitlight
Copy link
Author

We need sonic to expose path of FileSupply to prevent manually concat NAME.contract dir:

    impl FileSupply {
        pub fn path(&self) -> &Path {
            &self.path
        }

-->

            // Persist articles to target directory
            let new_supply = FileSupply::new(&name, &target_dir);
            let supply_dir = new_supply.path().to_owned(); // here
            let _new_pile = FilePile::<SealDef>::new(&name, &target_dir);
            let _new_stock = Stock::create(articles, new_supply);

            let stockpile = Stockpile::load(supply_dir);

@dr-orlovsky
Copy link
Member

Can you please update the PR to include the merged version?

@astral-bitlight
Copy link
Author

astral-bitlight commented Mar 18, 2025

I've made some updates to the import logic to ensure a complete import of data related to articles and the pile, as the previous version wasn't quite cutting it. Could you please take a look and let me know if it aligns with the RGB design? And let me know if you spot anything that needs correcting.

Here are the changes in this version:

  1. FileSupply::FILENAME_ARTICLES is now public to facilitate constructing the articles_path (hypersonic/src/stock.rs).
  2. Added a stockpile.merge_articles method (this PR).
  3. Added a filepile.export method (feat(pile): add export method to FilePile #301).
  4. Added a Stockpile::new method (this PR).

Thanks so much for your time and expertise!

Copy link
Member

@dr-orlovsky dr-orlovsky left a comment

Choose a reason for hiding this comment

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

Why do we need to import articles from an existing contract?

The only case when we need articles is where we issue new contracts (tokens). The issuer MUST not trust to other issuers and must pick an issuer object signed by some developer - not from other contract via articles.

Articles is not something which can be separated from a contract. I do not get why we need to import them in the first place...

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.

2 participants