Skip to content

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

Description

@mihaieremia

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()
    }

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions