Single Tx Profile Setup

Create and deploy new project

Create a new BackedBy protocol project in one transaction. This does not register with the Backed.By platform but can be completed there.

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;

import "IBBProfiles.sol";
import "IBBTiers.sol";
import "IBBSubscriptionsFactory.sol";

contract BBProfileSetup {
    constructor(
        IBBProfiles bbProfiles,
        IBBTiers bbTiers,
        IBBSubscriptionsFactory bbSubFactory,
        string memory profileCid,
        uint256[] memory tierPrices,
        string[] memory tierCids,
        bool[] memory tierDeprecated,
        uint256 contribution
    ) {
        uint256 profileId = _bbProfiles.createProfile(
            address(this),
            address(this),
            profileCid
        );
        uint256 tierSetId = _bbTiers.createTiers(
            profileId,
            tierPrices,
            tierCids,
            tierDeprecated,
            _defaultCurrencies,
            _defaultMul
        );

        _bbSubFactory.createSubscriptionProfile(
            profileId,
            tierSetId,
            contribution
        );

        _bbProfiles.editProfile(profileId, msg.sender, msg.sender, profileCid);
    }
}

Last updated