Description:
Smart contract deployed on Ethereum with Factory features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"contracts/ControllerFactory.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED
// Copyright 2025 US Fintech LLC, a N ew York company.
// Expressly for use under authorized whitelabeled platform
// operating on top of the Data Cloud OS platform like EquityMint.org or other platforms.
//
// Permission to use, copy, modify, or distribute this software is strictly prohibited
// without prior written consent from the copyright holder.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
// PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE,
// ARISING FROM, OUT OF, OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
// OFFICIAL DEL NORTE NETWORK COMPONENT
// ControllerFactory deploys the Controller, TokenContent, Token, and SaleManager contracts.
// @author Ken Silverman,
// US Fintech is a Limited Liability Company with offices in New York and Costa Rica
// Only corporations operating within their jurisidctional requirements
// and registered with the SEC or other regulatory body may deploy tokens under this framework.
// The deployer must have a subscription agreement, the hashcode of which is tied to the Token.
// See Equitymint.org or other authorized Data Cloud OS entities for more details.
// tokens created under this framework are subject to the terms and conditions of the subscription agreement.
// See Equitymint.org/tokensale for more information on the token project provided to you by the project owner.
// Enter the (Controller or token address) and symbol of such project there for more details.
// there you will be able to verify that the subscription agremeent is hosted properly
// at the URL/tokenAddress for the token you are deploying.
pragma solidity 0.8.30;
/// @author Ken Silverman
/// @notice This contract is used to deploy the Controller, TokenContent, Token, and SaleManager contracts.
contract ControllerFactory {
mapping(address => Deployment) public deploymentsByController;
mapping(address => Deployment[]) public deploymentsByUser;
uint256 public totalDeployments;
struct Deployment {
address controller;
address tokenContent;
address token;
address saleManager;
uint256 timestamp;
string projectName;
address deployer;
}
// ✅ Structs to reduce stack depth
struct ControllerParams {
address projectSuperAddress;
string platformName;
address platformTreasuryAddress;
string projectSuperName;
string projectSuperId;
string projectName;
string projectId;
}
struct TokenParams {
address initialAdmin;
string tokenName;
string tokenSymbol;
string tokenDescription;
uint256 maxSupply;
uint8 decimals;
}
struct TokenContentParams {
string tokenInfoBaseUrl;
bytes32 tokenInfoHash;
}
struct SaleManagerParams {
string issueTokenSymbol;
address ethUsdPriceFeed;
address usdtUsdPriceFeed;
address usdcAddress;
address usdtAddress;
}
event DeploymentComplete(
address indexed deployer,
address controller,
address tokenContent,
address token,
address saleManager,
string projectName,
uint256 timestamp
);
constructor() {}
function deployAll(
bytes memory controllerBytecode,
bytes memory tokenContentBytecode,
bytes memory tokenBytecode,
bytes memory saleManagerBytecode,
ControllerParams memory controllerParams,
TokenContentParams memory tokenContentParams,
TokenParams memory tokenParams,
SaleManagerParams memory saleManagerParams
) external returns (
address controller,
address tokenContent,
address token,
address saleManager
) {
// Deploy all 4 contracts
controller = _deploy(
abi.encodePacked(
controllerBytecode,
abi.encode(
controllerParams.projectSuperAddress,
controllerParams.platformName,
controllerParams.platformTreasuryAddress,
controllerParams.projectSuperName,
controllerParams.projectSuperId,
controllerParams.projectName,
controllerParams.projectId
)
),
"Controller"
);
tokenContent = _deploy(
abi.encodePacked(
tokenContentBytecode,
abi.encode(
controller,
tokenContentParams.tokenInfoBaseUrl,
tokenContentParams.tokenInfoHash
)
),
"TokenContent"
);
token = _deploy(
abi.encodePacked(
tokenBytecode,
abi.encode(
controller,
tokenParams.initialAdmin,
tokenParams.tokenName,
tokenParams.tokenSymbol,
tokenParams.tokenDescription,
tokenParams.maxSupply,
tokenParams.decimals,
tokenContent
)
),
"Token"
);
saleManager = _deploy(
abi.encodePacked(
saleManagerBytecode,
abi.encode(
controller,
token,
saleManagerParams.issueTokenSymbol,
saleManagerParams.ethUsdPriceFeed,
saleManagerParams.usdtUsdPriceFeed,
saleManagerParams.usdcAddress,
saleManagerParams.usdtAddress
)
),
"SaleManager"
);
// Register
Deployment memory deployment = Deployment({
controller: controller,
tokenContent: tokenContent,
token: token,
saleManager: saleManager,
timestamp: block.timestamp,
projectName: controllerParams.projectName,
deployer: msg.sender
});
deploymentsByController[controller] = deployment;
deploymentsByUser[msg.sender].push(deployment);
totalDeployments++;
emit DeploymentComplete(
msg.sender,
controller,
tokenContent,
token,
saleManager,
controllerParams.projectName,
block.timestamp
);
return (controller, tokenContent, token, saleManager);
}
function _deploy(bytes memory bytecodeWithParams, string memory label) internal returns (address deployed) {
bytes32 salt = keccak256(abi.encodePacked(msg.sender, totalDeployments, label, block.timestamp));
assembly ("memory-safe") {
deployed := create2(0, add(bytecodeWithParams, 0x20), mload(bytecodeWithParams), salt)
}
require(deployed != address(0), string(abi.encodePacked(label, " deployment failed")));
}
// ========================================================================
// VERIFICATION (Registry lookups - that's it!)
// ========================================================================
/**
* @notice Verify if controller was deployed by this factory
* @param controllerAddress Controller to check
* @return isOfficial True if in registry (deployed by factory)
* @return deployment Full deployment info (if official)
*/
function isOfficialDeployment(address controllerAddress)
external view returns (bool isOfficial, Deployment memory deployment)
{
deployment = deploymentsByController[controllerAddress];
isOfficial = deployment.controller != address(0);
}
/**
* @notice Get deployment info by controller address
*/
function getDeployment(address controllerAddress) external view returns (Deployment memory) {
return deploymentsByController[controllerAddress];
}
/**
* @notice Get all deployments by a user
*/
function getUserDeployments(address user) external view returns (Deployment[] memory) {
return deploymentsByUser[user];
}
/**
* @notice Get user's most recent deployment
*/
function getLastDeployment(address user) external view returns (Deployment memory) {
Deployment[] memory userDeps = deploymentsByUser[user];
require(userDeps.length > 0, "No deployments");
return userDeps[userDeps.length - 1];
}
}"
}
},
"settings": {
"optimizer": {
"enabled": true,
"runs": 10000
},
"viaIR": true,
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
}
}
}}
Submitted on: 2025-11-05 13:31:18
Comments
Log in to comment.
No comments yet.