S
StarrySky
Joined
icon image
Sui Community
0 REP
4 Feedbacks
1 Submission

Submissions

Submitted

# Dacade-SuiMove-LogisticsCompany **Note:** Please confirm that the environment is supported or compatible the sui verion **1.22.0** and the edition = " **2024.beta** ". ## 1 Entity Definition - AdminCap - Company - TransportItem - ItemInfomation - Customer ## 2 Entity Relationship - Package publisher(`AdminCap`) will charge 1% commission. - Any user can create or destroy their own logistics company(`Company`). - Customers can select a logistics company and place an order. <br>At the same time, customers will receive the corresponding express delivery order(`TransportItem`).<br>Correspondingly, item information(`ItemInfomation`) is stored by the company. ## 3 Economic Design - Every logistics company can customize its price and publish it based on the unit price per hundred grams. If the weight is less than 100g, it will be calculated as 100g. - Customers need to pay in full when placing an order, but this amount will not directly arrive in the account of the founder of the logistics company. Only when the customer confirms receipt of the goods with the courier order, or after the express delivery exceeds a certain period and the logistics company defaults to receiving the goods, will the money actually arrive in the account. - Whthin 3 epoch, customers can refunds their items, of course, they need to hold the correct courier order. - Logistics companies can only withdraw confirmed funds, but this process requires paying a 1% commission to the package publisher. ## 4 API Definition - **create_company:** Create a new logistics company and initializes its fields. - **confirm_items:** Logistics companies can confirm orders that have not been confirmed for a long time. - **cash:** The logistics company withdraws the confirmed funds. - **destroy_company:** On the premise that all orders have been processed and the funds have been withdrawn, cancel the company. - **create_item:** The customer places an order, and the system generates express order, cargo information. - **refunds:** Refunds will be processed for orders no more than 3 epoch and for which receipt has not been confirmed. - **confirm_receipt:** Customer confirms receipt.

90Points
8 Feedbacks

FEEDBACK

Submitted

# Dacade-SuiMove-LogisticsCompany **Note:** Please confirm that the environment is supported or compatible the sui verion **1.22.0** and the edition = " **2024.beta** ". ## 1 Entity Definition - AdminCap - Company - TransportItem - ItemInfomation - Customer ## 2 Entity Relationship - Package publisher(`AdminCap`) will charge 1% commission. - Any user can create or destroy their own logistics company(`Company`). - Customers can select a logistics company and place an order. <br>At the same time, customers will receive the corresponding express delivery order(`TransportItem`).<br>Correspondingly, item information(`ItemInfomation`) is stored by the company. ## 3 Economic Design - Every logistics company can customize its price and publish it based on the unit price per hundred grams. If the weight is less than 100g, it will be calculated as 100g. - Customers need to pay in full when placing an order, but this amount will not directly arrive in the account of the founder of the logistics company. Only when the customer confirms receipt of the goods with the courier order, or after the express delivery exceeds a certain period and the logistics company defaults to receiving the goods, will the money actually arrive in the account. - Whthin 3 epoch, customers can refunds their items, of course, they need to hold the correct courier order. - Logistics companies can only withdraw confirmed funds, but this process requires paying a 1% commission to the package publisher. ## 4 API Definition - **create_company:** Create a new logistics company and initializes its fields. - **confirm_items:** Logistics companies can confirm orders that have not been confirmed for a long time. - **cash:** The logistics company withdraws the confirmed funds. - **destroy_company:** On the premise that all orders have been processed and the funds have been withdrawn, cancel the company. - **create_item:** The customer places an order, and the system generates express order, cargo information. - **refunds:** Refunds will be processed for orders no more than 3 epoch and for which receipt has not been confirmed. - **confirm_receipt:** Customer confirms receipt.

90Points
8 Feedbacks
Feedback

First of all, I would like to apologize for not updating due to health issues these days. Now, the code in github supports the mainnet instead of the beta version; the publisher withdrawal function has been added, the company owner's judgment and some codes have been optimized; and comments as detailed as possible have been added. I thought about separating the Company and Transport parts, but it seems to involve the problem of mutual import, which was not considered at the beginning of the design. Regarding this aspect, as well as other issues raised by everyone, we will take time to update it later.

Submitted

# Dacade-SuiMove-LogisticsCompany **Note:** Please confirm that the environment is supported or compatible the sui verion **1.22.0** and the edition = " **2024.beta** ". ## 1 Entity Definition - AdminCap - Company - TransportItem - ItemInfomation - Customer ## 2 Entity Relationship - Package publisher(`AdminCap`) will charge 1% commission. - Any user can create or destroy their own logistics company(`Company`). - Customers can select a logistics company and place an order. <br>At the same time, customers will receive the corresponding express delivery order(`TransportItem`).<br>Correspondingly, item information(`ItemInfomation`) is stored by the company. ## 3 Economic Design - Every logistics company can customize its price and publish it based on the unit price per hundred grams. If the weight is less than 100g, it will be calculated as 100g. - Customers need to pay in full when placing an order, but this amount will not directly arrive in the account of the founder of the logistics company. Only when the customer confirms receipt of the goods with the courier order, or after the express delivery exceeds a certain period and the logistics company defaults to receiving the goods, will the money actually arrive in the account. - Whthin 3 epoch, customers can refunds their items, of course, they need to hold the correct courier order. - Logistics companies can only withdraw confirmed funds, but this process requires paying a 1% commission to the package publisher. ## 4 API Definition - **create_company:** Create a new logistics company and initializes its fields. - **confirm_items:** Logistics companies can confirm orders that have not been confirmed for a long time. - **cash:** The logistics company withdraws the confirmed funds. - **destroy_company:** On the premise that all orders have been processed and the funds have been withdrawn, cancel the company. - **create_item:** The customer places an order, and the system generates express order, cargo information. - **refunds:** Refunds will be processed for orders no more than 3 epoch and for which receipt has not been confirmed. - **confirm_receipt:** Customer confirms receipt.

90Points
8 Feedbacks
Feedback

For some special reasons, I need to adapt to the new version in advance. At this time, I happened to meet this challenge and wanted to try it. Judging from the results, this has caused a lot of trouble to us all, so tomorrow I will modify the code and use a version that is stably supported by the main network.

Submitted

## 1 Entity Definition - SELF_SERVICE_LOTTERY - LotterySystem - Lottery - LotteryStub - NewLotteryEvent - WinEvent - EndEvent ## 2 Entity Relationship && Economic Design - use One-Time-Witness(`SELF_SERVICE_LOTTERY`) to create `Publisher`, who owned this object will charge 1% commission when the lottery draws. - `LotterySystem` is a shared object, which stored detail infomation of `Lottery`. - Everyone can create `Lottery` and customize selling prices, bonuses and other information. - Everyone can purchase `Lottery` and get the corresponding `LotteryStub`. - The lottery will be drawn automatically when the tickets are sold out, and anyone can have it drawn after the purchase period has expired. - Winning users can hold the `LotteryStub` to redeem their prizes. At the same time, the income from the lottery will be transferred to the initiator's account. Of course, the publisher of the system will also receive a part of the commission. - When a lottery ticket is not sold, or the redemption period has passed after the draw, you can choose to redeem the bonus, but the income is also real. - `NewLotteryEvent`, `WinEvent`, `EndEvent` will trigger event announcements at key nodes. ## 3 API Definition - **withdraw:** Publisher withdraws earnings. - **create_lottery && create_lottery_with_epoch:** Create a new set of lottery tickets and customize the selling price and bonus. The difference between the two is whether the sale period is default. - **fedeem_bonus:** Redeem the bonus, but the income is also real. - **announcement:** The winning information will be announced after the draw. - **buy_lottery:** When you pay a certain amount to purchase a lottery ticket, you will receive a corresponding voucher containing the prize redemption code. - **redeem_lottery:** Prizes can be redeemed with vouchers after the draw.

50Points
3 Feedbacks
Feedback

Hello nullccxsy, this is a very thoughtful way to implement a lottery because it requires little administrator intervention in the process other than creating a new lottery, but I found a few things that could be improved.

  • First of all, there is an unavoidable problem. Since everything on the chain is public and the randomness you use is based on the information on the chain, there may be cheating.
  • In some destroy function, you handled the income by the way. In my opinion, this approach is questionable. It increases the coupling of the program and makes accurate unit testing difficult to conduct. But if it is separated for managers to call, it may add a lot of code logic, so this part may require more consideration.
  • I noticed that many key nodes in your project have triggered events to disclose information, but only the events after successful redemption are missing, which makes players can only query and verify through sui client gas or the on-chain browser.
Submitted

# Dacade-SuiMove-LogisticsCompany **Note:** Please confirm that the environment is supported or compatible the sui verion **1.22.0** and the edition = " **2024.beta** ". ## 1 Entity Definition - AdminCap - Company - TransportItem - ItemInfomation - Customer ## 2 Entity Relationship - Package publisher(`AdminCap`) will charge 1% commission. - Any user can create or destroy their own logistics company(`Company`). - Customers can select a logistics company and place an order. <br>At the same time, customers will receive the corresponding express delivery order(`TransportItem`).<br>Correspondingly, item information(`ItemInfomation`) is stored by the company. ## 3 Economic Design - Every logistics company can customize its price and publish it based on the unit price per hundred grams. If the weight is less than 100g, it will be calculated as 100g. - Customers need to pay in full when placing an order, but this amount will not directly arrive in the account of the founder of the logistics company. Only when the customer confirms receipt of the goods with the courier order, or after the express delivery exceeds a certain period and the logistics company defaults to receiving the goods, will the money actually arrive in the account. - Whthin 3 epoch, customers can refunds their items, of course, they need to hold the correct courier order. - Logistics companies can only withdraw confirmed funds, but this process requires paying a 1% commission to the package publisher. ## 4 API Definition - **create_company:** Create a new logistics company and initializes its fields. - **confirm_items:** Logistics companies can confirm orders that have not been confirmed for a long time. - **cash:** The logistics company withdraws the confirmed funds. - **destroy_company:** On the premise that all orders have been processed and the funds have been withdrawn, cancel the company. - **create_item:** The customer places an order, and the system generates express order, cargo information. - **refunds:** Refunds will be processed for orders no more than 3 epoch and for which receipt has not been confirmed. - **confirm_receipt:** Customer confirms receipt.

90Points
8 Feedbacks
Feedback

First at all, let’s clarify the precautions mentioned at the beginning:
Note: Please confirm that the environment is supported or compatible the sui verion 1.22.0 and the edition = " 2024.beta ".
The mainnet has not yet been updated to support this, so it is deployed here on the testnet.
You can click to view the updated content of the new version.
Next, let's discuss the above question:

  1. In the new 2024 version, data structure visibility is emphasized, so public struct is necessary. At the same time, this is also to pave the way for private that may be supported in subsequent updates. In the new version, if you do not do this, an error will be reported.
  2. In the new version of 2024, some Sui's imports are introduced by default, so we do not need to repeat the operation.
  3. In the refunds function, the purpose of not adding & is to destroy it later, which means that this express order will no longer have any effect (and there is no need to exist).
  4. This is a good idea, allowing managers to decide for themselves when to withdraw funds.
  5. I don’t understand what you mean by modifying the code like this. Could you please provide detailed guidance? In my opinion, they seem to achieve the same purpose?
  6. In the previous short learning stage, the error codes were defined in this way, and the readability was indeed very poor. They will be modified later.
  7. I have indeed tried my best to ensure that it is empty before destroying it, but due to current limited capabilities, there may indeed be omissions. This part will be carefully studied and corrected based on the code you provided.
  8. Assume company.price_per_hundred_grams = 100 and weight = 2, if 2g is less than 100g, it needs to be calculated as 100g, so price = 100, but if you follow your modified codelet price = (weight + 99) / (100 * company.price_per_hundred_grams), the value will become 0.
    Please correct me if I understand this code incorrectly.
  9. The current logic is that ItemInformation will be removed once it is confirmed, so is it unnecessary to add an additional bool to confirm?