Skip to content

Instantly share code, notes, and snippets.

@stephancill
Last active December 6, 2024 09:44
Show Gist options
  • Save stephancill/c230143d6dd8102553d10feb0cd2a45a to your computer and use it in GitHub Desktop.
Save stephancill/c230143d6dd8102553d10feb0cd2a45a to your computer and use it in GitHub Desktop.

Creation code

const data = getCrowdfundDeploymentData({ name, symbol, creator });

// const humanReadableAbi = new ethersUtils.Interface(
//   CrowdfundFactoryERC20LaunchABI
// );
// const formatted = humanReadableAbi.format("full")[0];
const formatted =
"createERC20LaunchCrowdfund(address crowdfundImpl, tuple(address initialContributor, address initialDelegate, uint96 minContribution, uint96 maxContribution, bool disableContributingForExistingCard, uint96 minTotalContributions, uint96 maxTotalContributions, uint160 exchangeRate, uint16 fundingSplitBps, address fundingSplitRecipient, uint40 duration, address gateKeeper, bytes12 gateKeeperId) crowdfundOpts, tuple(string name, string symbol, uint256 customizationPresetId, tuple(address partyImpl, address partyFactory, address[] hosts, uint40 voteDuration, uint40 executionDelay, uint16 passThresholdBps, uint16 feeBps, address feeRecipient) governanceOpts, tuple(bool enableAddAuthorityProposal, bool allowArbCallsToSpendPartyEth, bool allowOperators, uint8 distributionsConfig) proposalEngineOpts, address[] preciousTokens, uint256[] preciousTokenIds, uint40 rageQuitTimestamp, address[] authorities) partyOpts, tuple(string name, string symbol, address recipient, uint256 totalSupply, uint256 numTokensForDistribution, uint256 numTokensForRecipient, uint256 numTokensForLP, address lpFeeRecipient) tokenOpts, bytes createGateCallData)";

const input = decodeFunctionData({
    abi: CrowdfundFactoryERC20LaunchABI,
    data,
});

const inputMap = {
    crowdfundImpl: input.args[0],
    crowdfundOpts: input.args[1],
    partyOpts: input.args[2],
    tokenOpts: input.args[3],
    createGateCallData: input.args[4],
};

// Calls syndicate API
await sendTransaction({
    address: crowdfundFactoryAddress,
    functionSignature: formatted,
    args: inputMap,
    metadata,
});

API Call/Response

{
  "projectId": "559cf25b-c431-4a10-82e6-3e652cc86dfb",
  "contractAddress": "0x52e506B58ef5f60Ae74bD04C9bc37A63863Dfe5d",
  "chainId": 8453,
  "functionSignature": "createERC20LaunchCrowdfund(address crowdfundImpl, tuple(address initialContributor, address initialDelegate, uint96 minContribution, uint96 maxContribution, bool disableContributingForExistingCard, uint96 minTotalContributions, uint96 maxTotalContributions, uint160 exchangeRate, uint16 fundingSplitBps, address fundingSplitRecipient, uint40 duration, address gateKeeper, bytes12 gateKeeperId) crowdfundOpts, tuple(string name, string symbol, uint256 customizationPresetId, tuple(address partyImpl, address partyFactory, address[] hosts, uint40 voteDuration, uint40 executionDelay, uint16 passThresholdBps, uint16 feeBps, address feeRecipient) governanceOpts, tuple(bool enableAddAuthorityProposal, bool allowArbCallsToSpendPartyEth, bool allowOperators, uint8 distributionsConfig) proposalEngineOpts, address[] preciousTokens, uint256[] preciousTokenIds, uint40 rageQuitTimestamp, address[] authorities) partyOpts, tuple(string name, string symbol, address recipient, uint256 totalSupply, uint256 numTokensForDistribution, uint256 numTokensForRecipient, uint256 numTokensForLP, address lpFeeRecipient) tokenOpts, bytes createGateCallData)",
  "args": {
    "0": "0xE13FA77479a95cE7609E2C0BB6C83418b27f6f9D",
    "1": {
      "initialContributor": "0xd94b86E234BEAEf96A16E5C4ef2859aC0278A61f",
      "initialDelegate": "0xd94b86E234BEAEf96A16E5C4ef2859aC0278A61f",
      "minContribution": "1500000000000000",
      "maxContribution": "1500000000000000000",
      "disableContributingForExistingCard": false,
      "minTotalContributions": "3000000000000000000",
      "maxTotalContributions": "30000000000000000000",
      "exchangeRate": "1000000000000000000",
      "fundingSplitBps": 0,
      "fundingSplitRecipient": "0x0000000000000000000000000000000000000000",
      "duration": 300,
      "gateKeeper": "0x0000000000000000000000000000000000000000",
      "gateKeeperId": "0x000000000000000000000000"
    },
    "2": {
      "name": "TEST round",
      "symbol": "ROUND-TEST",
      "customizationPresetId": "1",
      "governanceOpts": {
        "partyImpl": "0xE34b1b97DdE54DCB82ECa18317025f8e5fBB40Aa",
        "partyFactory": "0x68e9fC0e4D7af69Ba64dD6827BFcE5CD230b8F3d",
        "hosts": [
          "0xd94b86E234BEAEf96A16E5C4ef2859aC0278A61f"
        ],
        "voteDuration": 3600,
        "executionDelay": 3600,
        "passThresholdBps": 5000,
        "feeBps": 0,
        "feeRecipient": "0x0000000000000000000000000000000000000000"
      },
      "proposalEngineOpts": {
        "enableAddAuthorityProposal": true,
        "allowArbCallsToSpendPartyEth": false,
        "allowOperators": false,
        "distributionsConfig": 0
      },
      "preciousTokens": [],
      "preciousTokenIds": [],
      "rageQuitTimestamp": 0,
      "authorities": [
        "0xd94b86E234BEAEf96A16E5C4ef2859aC0278A61f"
      ]
    },
    "3": {
      "name": "TEST",
      "symbol": "TEST",
      "recipient": "0x0000000000000000000000000000000000000000",
      "totalSupply": "1000000000000000000000000000",
      "numTokensForDistribution": "50000000000000000000000000",
      "numTokensForRecipient": "0",
      "numTokensForLP": "950000000000000000000000000",
      "lpFeeRecipient": "0xd94b86E234BEAEf96A16E5C4ef2859aC0278A61f"
    },
    "4": "0x"
  }
}
Error sending transaction 400
 ⨯ Error: {
  "message": "Invalid ABI parameter.\n"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment