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

Feature: Manager SC, deploys child SC from template SC and execute a first ESDT issuing transaction #868

Open
mihaieremia opened this issue Aug 16, 2024 · 0 comments

Comments

@mihaieremia
Copy link

Scenario of a real flow made by XOXNO:

  • Someone pays to create his first event, we are requesting from the user all info about the event + collection details (token name, token ticker).

  • We have in our manager SC an endpoint called register that is payable.

  • Each register transaction is deploying a child SC for the specific user, in the same transaction we would want to trigger also inside the child SC an ESDT token issuing request.

Currently the above flow fails at the issuing of the transaction towards the newly created child SC address (as far as I remember with the error: account not found).

I suspect that the VM is not allowing transaction execution to new SCs until the SC deploy TX is not final.

A snippet from our flows:

    #[payable("EGLD")]
    #[endpoint(listing)]
    fn listing(
        &self,
        tag: &ManagedBuffer,
        cid: ManagedBuffer,
        tags: ManagedBuffer,
        base_nft_name: ManagedBuffer,
        royalties: BigUint,
        token_name: ManagedBuffer,
        token_ticker: ManagedBuffer,
        collection_size: usize,
        global_max_per_wallet: u32,
        collectiontag: ManagedBuffer,
        nft_ending: ManagedBuffer,
        name_shuffle: bool,
        has_attributes: bool,
        has_kyc: bool,
        refund_policy: bool,
        public_burn: bool,
        bot_protection: bool,
        has_reveal: bool,
    ) {
        let payment_amount = self.call_value().egld_value();
        let fees = self.register_fees().get();
        require!(
            payment_amount.clone_value() == (&fees + NFT_ISSUE_COST),
            "The fees paid is not matching the required amount + issuing the collection ticker!"
        );

        let new_contract = self.common_register(
            tag,
            OptionalValue::None,
            OptionalValue::Some(self.blockchain().get_caller()),
        );

        self.tx()
            .to(self.accumulator_sc().get())
            .typed(accumulator::AccumulatorProxy)
            .deposit()
            .egld(fees)
            .sync_call();

        self.tx()
            .to(new_contract)
            .typed(launchpad_proxy::MinterProxy)
            .listing(
                cid,
                tags,
                base_nft_name,
                royalties,
                token_name,
                token_ticker,
                collection_size,
                global_max_per_wallet,
                collectiontag,
                nft_ending,
                name_shuffle,
                has_attributes,
                has_kyc,
                refund_policy,
                public_burn,
                bot_protection,
                has_reveal,
            )
            .egld(NFT_ISSUE_COST)
            .sync_call()
    }

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

No branches or pull requests

1 participant