Cero-Trade / CeroTrade-IREC-LATAM

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.
https://www.cerotrade.cl/
Other
0 stars 0 forks source link

Market - Change totalQuantity to method #39

Open cerotrade opened 7 months ago

cerotrade commented 7 months ago

Right now, the Market canister has a tokensInMarket hashmap, that stores tokenInfo, that contains the total amount of the token, and a hashmap called UserxToken, that specifies how many tokens each user has. So, when an amount of token is changed in the market (put on market or take off market), two changes must be made, in the UserxToken map and in the totalQuantity variable in tokenInfo.

Now, tokensInMarket should map tokenID --> UserxToken, and when tokens are added or removed from market, only that map should change (the amount put in market by that user). If the total amount of that token in market is needed, the method totalAmount(tokenID) should be called.

Acceptance Criteria