-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: psp22 Dao_example0 #422
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Amazing work!
Right now the example doesn't make sense to me or it is not "fun" enough. This dao funds projects with its own governance token, I think it should be a token holding value, like DOT / USDT / USDC (much cooler!). Moreover, people buy voting power with the governance token, why is their balance of the governance token simply not checked using the api? Then we don't need all the storage in the contract. Doing some research to token based daos, this is also the main implementation of it (e.g. uniswap dao). I think doing some research to how a token based dao works would be good and see what makes sense with e.g. USDT funding proposals.
Moreover, the goal of this contract example is to show how easy it is to interact with the fungibles api and build your use case around it. Right now we are only using the create
and transfer_from
methods, can we think of more (e.g. mint
or burn
, minting when buying the governance token, burning when voting or creating a proposal). This should only be added if it makes sense with the overall implementation of the dao though. Alternative is interacting with multiple tokens (e.g. usdt). Also, leave out the word psp22, this is not applicable here. A contract is compliant to this standard only if it contains all functions and events specified in the standard.
As we had a conversation somewhere else I will stop my review now. Next steps are to define the story of the dao, then finalise the contract and tests.
pub enum RuntimeCall { | ||
/// We can add additional pallets we might want to use here | ||
#[codec(index = 150)] | ||
Fungibles(FungiblesCall), | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not necessary if we only do the FungiblesCall
#[ink::scale_derive(Encode)] | ||
pub enum FungiblesCall { | ||
#[codec(index = 4)] | ||
TransferFrom { token: TokenId, from: AccountId, to: AccountId, value: Balance }, | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also unnecessary if we only do TransferFrom
/// Allows a user to become a member of the Dao | ||
/// by transferring some tokens to the DAO's treasury. | ||
/// The amount of tokens transferred will be stored as the | ||
/// voting power of this member. | ||
/// | ||
/// # Parameters | ||
/// - `amount` - Balance transferred to the Dao and representing | ||
/// the voting power of the member. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we use cargo +nightly fmt --all
please.
Also, in trade for the native token, the member will get the same amount of the governance token which can be used for voting.
/// the voting power of the member. | ||
|
||
#[ink(message)] | ||
pub fn join(&mut self, amount: Balance) -> Result<(), Error> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No transfer of the native token from the caller to the dao?
Also, can we perhaps use mint here to add the amount of different functions that we use of the api?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This message should also be after instantiating the dao. Right now there are all these functions which require to be a member but this function is all the way at the end.
pub enum Error { | ||
/// This proposal does not exists | ||
ProposalNotFound, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove whitespace, with all types please
self.members | ||
.insert(caller, &Member { voting_power, last_vote: member.last_vote }); | ||
|
||
self.env().emit_event(Transfer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get it, we are transferring the dao token from the caller to the dao? Shouldn't the caller get the dao token from the amount of the native token it buys it for?
Description
Issue #337
This contract implements a Decentralized Autonomous Organization using Psp22 for Projects funding.
The key functionalities include:
ToDo