reigsterModel(contract, sender, data, currency)

Feature

Return raw operation that creates a new 'DAO model'. Note : Only contract owner or handler can execute.

Parameters

string contract address, string sender, object daoData, string currency ID

Return Value

object register model operation

// [ parameter daoData’s structure ]

{
          option: "crypto" | "biz",
          votingPowerToken: string | CurrencyID,
          threshold: string | number | Big,
          proposalFee: string | number | Big,
          proposerWhitelist: (string | Address)[],           
          proposalReviewPeriod: string | number | Big,           // unit in seconds
          registrationPeriod: string | number | Big,                   // seconds
          preSnapshotPeriod: string | number | Big,                 // seconds
          votingPeriod: string | number | Big,                            // seconds
          postSnapshotPeriod: string | number | Big,               // seconds
          executionDelayPeriod: string | number | Big,             // seconds
          turnout: string | number | Big,                                     // percentage
          quorum: string | number | Big,                                     // percentage
}  

  • option: proposal type

  • votingPowerToken: token symbol which will be used for calculate voting power and pay proposal fee.

  • threshold : minimum token holdings to propose

  • proposalFee : the fees to propose, the fee transfer to contract account

  • proposerWhitelist : people who is authorized to make suggestions. If an empty array, all members can propose.

  • proposalReviewPeriod : delay time before registration-period (in seconds)

  • registrationPeriod : voter registration period (in seconds)

  • preSnapshotPeriod : snap time before voting-period (in seconds)

  • postSnapshotPeriod : snap time after voting-period (in seconds)

  • executionDelayPeriod : time-lock before execution (in seconds)

  • turnout : minimum rate of attendees for a proposal to pass (in percentage)

  • quorum : minimum rate of upvotes for a proposal to pass (in percentage)

example

const contractAddress = "0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca";
const sender = "0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca";
const currencyID = "MCC";

const daoData = {
    option: "crypto",
    votingPowerToken: "MCC",
    threshold: 1000,  // proposer must have more than 1000 MCC.
    proposalFee: 100,         // proposer will pay 100 MCC to propose
    proposerWhitelist: ["0x07469989b2562afF5E5C3B116CD3AA5Ef814e5a1fca"],
    proposalReviewPeriod: 1800000,  // start time + 1800000
    registrationPeriod: 3500000,    // proposalReviewPeriod + 3500000
    preSnapshotPeriod: 1800000,     // registrationPeriod + 1800000
    votingPeriod: 6000000,          // preSnapshotPeriod + 6000000
    postSnapshotPeriod: 1800000,    // votingPeriod + 1800000
    executionDelayPeriod: 3000000,  // postSnapshotPeriod + 3000000
    turnout: 33,                    // registration must exceed 33%
    quorum: 50,                     // vote result must exceed 50%
};

const operation = mitum.dao.registerModel(contractAddress, sender, daoData, currencyID);
console.log(operation);

// output
Operation {
  id: 'mitum',
  fact: RegisterModelFact {
    hint: Hint { s: 'mitum-dao-register-model-operation-fact' },
    token: Token { s: '2024-06-25 09:22:45.178 +0000 UTC' },
    _hash: <Buffer b9 8e 8f 7d 1c 4a 76 51 d0 4b ea 34 e9 57 4a c6 a2 f0 c9 ac 98 60 6e da 4b 3d 88 20 0b 1e 35 a2>,
    sender: Address {
      s: '0x4874C17C354c498cf44D2946612DBe47fBcE7E87fca',
      type: 'mitum'
    },
    contract: Address {
      s: '0x41EFb6902ADcb1214a7123b01af66b1D13b89864fca',
      type: 'mitum'
    },
    currency: CurrencyID { s: 'MCC' },
    option: 'crypto',
    policy: DAOPolicy {
      hint: [Hint],
      votingPowerToken: [CurrencyID],
      threshold: [Big],
      proposalFee: [Fee],
      proposerWhitelist: [Whitelist],
      proposalReviewPeriod: [Big],
      registrationPeriod: [Big],
      preSnapshotPeriod: [Big],
      votingPeriod: [Big],
      postSnapshotPeriod: [Big],
      executionDelayPeriod: [Big],
      turnout: [Big],
      quorum: [Big]
    }
  },
  hint: Hint { s: 'mitum-dao-register-model-operation' },
  _factSigns: [],
  _hash: <Buffer >
}

Last updated