Dao contract guide
We can create a Dao contract for an user using the DaoRegister contract deployed by Relation Protocol. A dao contract can provide a Dao with member management functions. Both the DaoRegister contract and the Dao contract implement the contract interface defined by the Contract Standard.
Construct a Contract object
Via Relation Protocol's resource list, you can acquire the contract address and abi file of DaoRegister and DaoWithSign, and the abi file of Dao contract. As for the address of a Dao contract, you need to query it through DaoRegister.
Construct a DaoRegisterContract object:
import { ethers, providers } from 'ethers'
const getDaoRegisterContractInstance = () => {
// DaoRegister's contract address
const contractAddress = '0xAC0f863b66173E69b1C57Fec5e31c01c7C6959B7'
const provider = new providers.Web3Provider(window.ethereum)
const signer = provider.getSigner()
const contract = new ethers.Contract(contractAddress, daoRegisterAbi, signer)
return contract
}
const getDaoWithSignContractInstance = () => {
// DaoRegister's contract address
const contractAddress = '0xAC0f863b66173E69b1C57Fec5e31c01c7C6959B7'
const provider = new providers.Web3Provider(window.ethereum)
const signer = provider.getSigner()
const contract = new ethers.Contract(contractAddress, daoWithSignAbi, signer)
return contract
}How to call a contract
DaoRegister
Deploy a Dao contract
Query the list of Daos created by an user
You can get the list of Daos created by a user by using a traversal process to go through the tokens held on the DaoRegister contract by said user.
Construct a DaoContract Object
Dao
Query the administrator of a Dao
Configure the DaoURI
The administrator of a Dao can assign description and avatar for a Dao, with the description and avatar stored on Arweave. We use the data format for this as follows:
The transaction hash of the upload will be stored in the contract as DaoURI
Query the DaoURI
Modify a Dao's name
The administrator of a Dao can modify its name.
Query a Dao's name
When an administrator adds a member to a Dao
An administrator can add specific addresses to a Dao.
Open Access(Optional for a Dao)
An administrator of a Dao can set it to Open Access, meaning that anyone can join the Dao.
When a user joins a Dao
With Open Access enabled by the administrator of a Dao, users can join the Dao freely.
Remove a Dao member
An administrator can remove a member from a Dao. Also, users can leave a Dao freely.
Query the list of Dao members
You can get a whole list of Dao members with a traversal process to find all the token owners of said Dao.
Configure the DaoURI(Gas fee can be paid by someone else)
The administrator of a Dao can assign description and avatar to a Dao, with the content stored on Arweave. The format of the content should be:
The administrator signs against the transaction hash and constructs a parameter to be posted on the blockchain. Any address can use this parameter to initiate a transaction on the blockchain, with the gas fee paid by said address.
When an administrator adds a member to a Dao(Gas fee can be paid by someone else)
An administrator can add specific addresses to a Dao.
Open Access(Gas fee can be paid by someone else)
An administrator of a Dao can set it to Open Access, meaning that anyone can join the Dao.
When an user joins a Dao(Gas fee can be paid by someone else)
With Open Access enabled by the administrator of a Dao, users can join the Dao freely.
Remove a Dao member(Gas fee can be paid by someone else)
An administrator can remove a member from a Dao. Also, users can leave a Dao freely.
Last updated