Cero Trade is a decentralized platform for trading, buying, and redeeming tokenized IRECs (renewable energy certificates). It features a marketplace where users can manage their assets, redeem certificates, and list them for sale. With real-time data from the I-TRACK API, traders can make informed decisions.
User Story
As a user, I want to trigger the selling flow through inter-canister communication after selecting the number of tokens I want to sell, to streamline and customize my experience in the DApp.
Acceptance Criteria
[ ] User must be precented with an error if invalid amount is selected.
[ ] The market canister must determine if the tokenID is already on the market, ensuring the user's offer is appropriately aggregated with existing offers, or create a new market entry if it is not.
[ ] The market canister should verify against the UserxToken map whether the user has an existing selling offer for the same tokens and update the offer accordingly.
[ ] The system must handle errors robustly, ensuring that in case of an error, the transaction is fully reverted and the user is informed of the failure.
Tasks
[ ] Implement the addToMarket method in the frontend canister to initiate the selling process through the agent.
[ ] Code the sellToken method in the agent canister to request the market canister to list the user's token offer.
[ ] Develop the putOnSale method in the market canister, including the isOnMarket check to assess if a token is currently being sold.
[ ] Create the newTokenInMarket method in the market canister to handle new token records in the tokensInMarket hashmap and to update the TokensxUsers hashmap within TokenMarketInfo.
[ ] Construct the addAmount method in the market canister to update the selling quantity for a user in the TokensxUsers hashmap, and to adjust the totalQuantity for a tokenID in TokenMarketInfo.
[ ] Establish the addTokenToMarket method in the agent canister, which orchestrates the update of token information in the user canister, including locating the user canister via the UserIndex canister, and updating the inMarket status in the tokenList.
[ ] Ensure all new methods are accompanied by appropriate error handling routines to manage partial failures and provide transactional integrity.
User Story As a user, I want to trigger the selling flow through inter-canister communication after selecting the number of tokens I want to sell, to streamline and customize my experience in the DApp.
Acceptance Criteria
tokenID
is already on the market, ensuring the user's offer is appropriately aggregated with existing offers, or create a new market entry if it is not.Tasks
addToMarket
method in the frontend canister to initiate the selling process through the agent.sellToken
method in the agent canister to request the market canister to list the user's token offer.putOnSale
method in the market canister, including theisOnMarket
check to assess if a token is currently being sold.newTokenInMarket
method in the market canister to handle new token records in thetokensInMarket
hashmap and to update theTokensxUsers
hashmap withinTokenMarketInfo
.addAmount
method in the market canister to update the selling quantity for a user in theTokensxUsers
hashmap, and to adjust thetotalQuantity
for atokenID
inTokenMarketInfo
.addTokenToMarket
method in the agent canister, which orchestrates the update of token information in the user canister, including locating the user canister via theUserIndex
canister, and updating theinMarket
status in thetokenList
.