u
unpWn4bl3
Joined
icon image
Sui Community
0 REP
2 Feedbacks
1 Propuesta

Propuestas

Enviado

A zkLogin defi-app that you can create merchant with random power(up to 0xdeadbeef), and trade them on market! Usage Instruction Publish required package and create market, edit the .env in frontend/ according to READMD.md. In DApp user can login with Google account using zkLogin. User can see thier merchants, create new one and trading on markets. Contracts API definition soldier::merchant::new_merchant(name_vec:vector<u8>, clock: &Clock, ctx:&mut TxContext) create a merchant with custom name. suimarket::merchantmarket::create_marketplace(ctx:&mut TxContext) create a market place to sell&buy merchant suimarket::merchantmarket::sell_merchant(market:&mut Market,merchant: Merchant,price: u64,ctx:&mut TxContext) sell the merchant with price in MIST, which would emit a MerchantListed{order_id: u64,seller: address} event. suimarket::merchantmarket::buy_merchant(market:&mut Market,order_id: u64,payment: Coin<SUI>,ctx:&mut TxContext) buy the merchant in order id with SUI coin as payment, which would emit a MerchantBought{merchant_id:ID,buyer:address} event. suimarket::merchantmarket::get_profits(market:&mut Market,ctx:&mut TxContext) let user get profits, transfer the SUI coin to user account.

70Puntos
4 Feedbacks

FEEDBACK

Enviado

A zkLogin defi-app that you can create merchant with random power(up to 0xdeadbeef), and trade them on market! Usage Instruction Publish required package and create market, edit the .env in frontend/ according to READMD.md. In DApp user can login with Google account using zkLogin. User can see thier merchants, create new one and trading on markets. Contracts API definition soldier::merchant::new_merchant(name_vec:vector<u8>, clock: &Clock, ctx:&mut TxContext) create a merchant with custom name. suimarket::merchantmarket::create_marketplace(ctx:&mut TxContext) create a market place to sell&buy merchant suimarket::merchantmarket::sell_merchant(market:&mut Market,merchant: Merchant,price: u64,ctx:&mut TxContext) sell the merchant with price in MIST, which would emit a MerchantListed{order_id: u64,seller: address} event. suimarket::merchantmarket::buy_merchant(market:&mut Market,order_id: u64,payment: Coin<SUI>,ctx:&mut TxContext) buy the merchant in order id with SUI coin as payment, which would emit a MerchantBought{merchant_id:ID,buyer:address} event. suimarket::merchantmarket::get_profits(market:&mut Market,ctx:&mut TxContext) let user get profits, transfer the SUI coin to user account.

70Puntos
4 Feedbacks
Feedback

Hello @coolestnick and @Spydiecy, I've learned a lot in you review. Writing a smart contract in move is something new to me so I'm not very clear about the design pattern. Anyway, pr merged and thanks for your advice!

Enviado

This is a DAO based on a certain kind of `Governance Coin` to publish, vote for and finally execute the `Proposal`s. ### Governance Coin Based on the standard `Coin` library in `sui`. It is used to vote for proposals, and one coin stands for one vote. The coin was first created with a certain amout and could be minted by the TreasuryCap owner. ### Proposal The `Proposal`s are defined with a `start_time` and an `end_time` to indicate the voting time interval. Besides, `Proposal`s also have a `minimal votes required` limit to indicate the minimal votes for execution(both for and against would count) ### Voting When voting starts, anyone holding the `Governance Coin` could vote for/against the proposal and the coin will **NOT** be consumed. Each address could vote only once for each proposal. ### Proposal Execution When the voting period ends, any one could invoke the `execute_proposal` function to execute the proposal. ## Code Structure `Governance Coin` and `MyDao` are separated into two move files ## Events Proposal creation, voting, proposal execution will be logged as events.

70Puntos
5 Feedbacks
Feedback

Hello xerath, your code is well organized and tested, and I made some changes for better readbility:

Error code name

All error code is now prefixed with "E_" for better calssification

Comment enhancing

Some minor changes to comment is made for clarity

Code style

  • Emit the event directly, for simplifying variable name management
  • Add spaces between arithmatic operations and variables
  • Function definition is seperate into multiple lines with one parameter per line for better type information