@daohaus/contract-utils
Contract utils provides TypeScript wrappers for our primary contracts. While you will read state data from moloch-v3-data
, contract-utils
equips you with instances of the contract and access to a set of helpers for making function calls and writing data to the contracts.
It utilizes TypeChain (opens in a new tab) for type generation.
Github (opens in a new tab)
- Summon DAOs (opens in a new tab)
- Create DAO Proposals (opens in a new tab)
- Encoding Helpers (opens in a new tab)
- Gas Estimate Helpers (opens in a new tab)
- Summoning Params Helpers (opens in a new tab)
- Types (opens in a new tab)
NPM (opens in a new tab)
Usage
Installation
yarn add @daohaus/profile-data
Requirements
This packages uses ethers.js
(opens in a new tab) providers and RPC endpoints to create the connection to the blockchain and contract. You should provide an ether.js
provider.
Examples
How to init a contract and make a function call
import { MolochV3Contract } from '@daohaus/contract-utils';
const molochV3 = MolochV3Contract.create({
address: '0x0somedaoaddress',
provider: new ethers.providers.JsonRpcProvider(
'https:///someProviderUrl.com'
),
});
molochV3.sponsorProposal('1');
How to summon a DAO
Checkout the DAOhaus User Guide (opens in a new tab) for details on the process and parameters.
import { MolochV3AdvTokenSummonerContract } from '@daohaus/contract-utils';
const molochV3AdvSummoner = MolochV3AdvTokenSummonerContract.create({
networkIs: '0x5',
provider: new ethers.providers.JsonRpcProvider(
'https:///someProviderUrl.com'
),
});
const daoSetUpData = {
sharesTokenName: 'Voting',
sharesTokenSymbol: 'vote',
lootTokenName: 'nonVoting',
lootTokenSymbol: 'nvote',
safeAddress:
'address if using exsiting safe for treasury, blank if creating a new one',
tokenConfig: {
pauseShares: true,
pauseLoot: true,
},
governanceConfig: {
voting: 86400,
grace: 86400,
newOffering: 0,
quorum: 0,
sponsor: 0,
minRetention: 66,
},
shamanConfig: {
shamans: ['shamanAddress'],
permissions: [2],
},
sharesConfig: {
to: ['initialMemberAddress', 'initialMemberAddress'],
amount: [1000000000000000000, 2000000000000000000],
},
lootConfig: {
to: ['initialLootHolderAddress'],
amount: [1000000000000000000],
},
daoName: 'Cheese DAO',
};
await molochV3AdvSummoner.summonMolochV3(daoSetUpData);