Submissions
# 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.
FEEDBACK
# 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.
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.
# 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.
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.
## 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.
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.
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.sui client gas
or the on-chain browser.# 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.
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:
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.Sui's imports
are introduced by default, so we do not need to repeat the operation.&
is to destroy it later, which means that this express order will no longer have any effect (and there is no need to exist).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.ItemInformation
will be removed
once it is confirmed, so is it unnecessary to add an additional bool
to confirm?Dacade is an open-sourced platform and is created in collaboration with multiple contributors. Go to the repository to start contributing.