Slack Channel Integration for Photosynthesis Project Development/Discussion Support

:dart: Dear Sir,

I am kindly solo developer of full project and sub components.

While I appreciate the existing setup on Telegram, incorporating Slack could significantly enhance the workflow. :arrows_counterclockwise: Slack’s structured channels and integration capabilities make it ideal for detailed, segmented discussions on various aspects of cosmos SDK module/Dapps(Rust smart contracts), particularly for in-depth code reviews and logging discussions. :bar_chart:

Cosmos sdk module async discussion and meetings timeline/planning work,

Considering the complexity and scope of cosmos sdk modules

Integration timeline and detailed module discussions plan. :date:
:orange_heart::rose::purple_heart::rose::gift::gift::video_game::video_game::rose::rose:

1)Photosynthesis liquid staking :herb: :smiling_face_with_three_hearts::smiling_face_with_three_hearts::rose::rose:

Rust smart contract port of photosynthesis cosmos sdk module is also available and pros/cons documentation of using Rust smart contract vs cosmos sdk module for (photosynthesis module) is also available. :smiling_face_with_three_hearts::smiling_face_with_three_hearts::rose::rose:

A simplied rust smart contract port for photosynthesis module is also kindly available apart from full port. :smiling_face_with_three_hearts::smiling_face_with_three_hearts::rose::rose:

Is it kindly optimum to integrate full cosmos sdk module (including ICA module, Interchain query module, epoch module, photosynthesis module) (will full stream staking support) currently in Archway chain shortly (A/B Tests on current live chain can be started).
Documentation already kindly submitted, Really excited about individual modules discussion, photosynthesis liquid staking module/epoch module/ICA/Interchain query module discussion with the team, cosmos sdk code/functions/begin/end blocker,configuration discussion) and question/answer session.

Really excited about Stride Liquid staking protocol Protocol deep discussion with the team covering ICA, Interchain queries, full code of stride, my Stride Ebook, Workflow Diagrams, automatic liquid staking workflows, ML based optimisation of Redemption rate yield metric deep discussion.
Question/Answer session with the team. (Insights of stride team in this context)

Simplified Rust smart contract based Dapp for Stride Liquid staking will be available very shortly for simple (with less features) for liquid staking.(A/B Testing completed)
Rust smart contract code/functions deep discussion, load testing/benchmarks of smart contracts.

Stream staking, epoch, Liquid staking queue overhead for cosmwasm Dapp is high as compared to cosmos SDK and can kindly consume extra cosmwasm resources with full other Dapps ecosystems running.

After covering Stride, quicksilver and persistence one, discussion will also follow.

2)x-callback module enhancement code :smiling_face_with_three_hearts::smiling_face_with_three_hearts::rose::rose:

(Priority/Delay queue Data structures, existing callback module refinement/optimisation discussion, fee savings discussion using Priority/Delay queue Data Structures)

3)Dapps/rust smart contracts :smiling_face_with_three_hearts::smiling_face_with_three_hearts::rose::rose:

Protocol Presentations/Question Answer Sessions for below protocols.
Rust smart contract code/functions deep discussion, load testing/benchmarks of smart contracts. External Protocols - EVMOS, Filecoin Integration discussion.
Heavy Transaction Guaranteed Dapps on Daily Basis.

1)Photosynthesis-Dorahacks-web3-competition-winner/prototypesindev/matrixbrainbatterysmartcontract at main · suhasagg/Photosynthesis-Dorahacks-web3-competition-winner · GitHub (A/B Testing completed)

2)Photosynthesis-Dorahacks-web3-competition-winner/prototypesindev/cookiesyncsmartcontract at main · suhasagg/Photosynthesis-Dorahacks-web3-competition-winner · GitHub (A/B Testing completed)

3)Photosynthesis-Dorahacks-web3-competition-winner/prototypesindev/adserversmartcontract at main · suhasagg/Photosynthesis-Dorahacks-web3-competition-winner · GitHub ((A/B Testing completed)

Having both platforms in sync could provide a comprehensive environment, facilitating better/clear communication and ensuring thorough review processes before going live. :rocket:

4)NFT Projects :framed_picture: :smiling_face_with_three_hearts::smiling_face_with_three_hearts::rose::rose:

Discussion on image features, refinements, and customizations for media-based products (Hollywood and other taxonomy media (next generation subject/concepts/semantics/tech based NFTs)). Porting Images to 3D/Holographic Devices Display support (Home use/For use in shopping malls) is also available.

Let’s discuss this further and explore how we can integrate Slack effectively alongside Telegram to optimize collaboration and software documentation/code/NFT media deep discussions. :chart_with_upwards_trend:

Looking forward for thoughts!! :smiling_face_with_three_hearts::smiling_face_with_three_hearts::rose::rose:

2 Likes

Just a note, I looked at these contracts and it seems like they’re not deployable. They’re using packages like Rand and others that won’t pass compilation with the CosmWasm optimizer. Have you tried deploying them on testnet?

1 Like

Happy Saturday!!
:heart: :green_heart: :orange_heart: :purple_heart: :blue_heart: :yellow_heart: :rose: :heart_hands: :heart_hands: :rose: :bulb: :flashlight:


electron proton neutrons :smiling_face_with_three_hearts: :smiling_face_with_three_hearts: :smiling_face_with_three_hearts:

Kindly adding finishing touch to smart contracts
1)optimising smart contract deployment size
2)ensuring transaction latencies/gas fee consumptions are minimum
3)Locking feature threshold of Dapps upto granularity satisfaction to present to the clients.
Will kindly provide more details shortly in this context.

2 Likes

Dear Sir,

How are you… :orange_heart:

I have kindly integrated cosmwasm smart contract testing frameworks in smart contract Dapps

Cwmultitest framework Integration:

The cwmultitest framework is a powerful tool for testing CosmWasm smart contracts. It allows for advanced testing scenarios by providing a mock blockchain environment.

I have kindly taken reference from - GitHub - archway-network/cw721-marketplace: Contracts for a variety of types of cw721 marketplaces

Stress Test Implementation -

The :test_tube: stress test implemented for the :desktop_computer: ad server smart contract is designed to evaluate how well the contract performs under heavy load :weight_lifting_man:. It involves adding a large number of :loudspeaker: ads and then serving each of them :chart_with_upwards_trend:.

:star2: Significance of the Stress Test

:rocket: Scalability:
This test evaluates how the contract performs when the number of operations scales significantly. Handling 1000 ads without performance issues demonstrates that the contract can handle large amounts of data :bar_chart: and frequent interactions :zap:.

:hammer_and_wrench: State Consistency:
The test ensures that the state (i.e., the views counter for each ad) remains consistent :abacus: even when multiple ads are being served in rapid succession :arrows_counterclockwise:. This is crucial for maintaining data integrity during high traffic.

:chart_with_upwards_trend: Performance Metrics:
The time measurements :hourglass_flowing_sand: for adding and serving ads provide valuable data :bar_chart: on the performance of the contract. If the time taken increases significantly with the number of ads, it might indicate potential performance bottlenecks :construction:.

:wrench:Extensions

:muscle: Higher Load Testing:
The number of ads can be increased beyond 1000 to test the limits :dart: of the contract’s storage and performance capabilities. Pushing the boundaries can reveal how the system handles extreme conditions.

:busts_in_silhouette: Concurrent Testing:
Simulate multiple users :bust_in_silhouette::bust_in_silhouette: interacting with the contract simultaneously to test how well it handles concurrent transactions :person_juggling:. This can help ensure the contract remains functional under realworld scenarios with multiple users.

:fuelpump: Gas Usage Analysis:
Measure the gas consumption :fuelpump: for adding and serving ads under high load to ensure the contract remains costeffective :money_with_wings: to use. Optimizing gas usage can help reduce costs for contract interactions, making it more efficient.

:globe_with_meridians: These stress tests ensure contract is scalable, consistent, and efficient for users, providing a reliable and smooth experience even under heavy load. :rocket:

1)Photosynthesis-Dorahacks-web3-competition-winner/prototypesindev/adserver-cw_multi_test/src/contract_stress_test.rs at main · suhasagg/Photosynthesis-Dorahacks-web3-competition-winner · GitHub

:rocket: Stress Test evaluates the :bar_chart: performance and :globe_with_meridians: scalability of the smart contract :memo::scroll::computer: designed for handling cookie sync :cookie::cookie: using the CosmWasm MultiTest framework :hammer_and_wrench:.

:rocket: Scalability: The test measures how well the contract performs when subjected to a large number of operations. In this case, it evaluates how the contract manages :cupcake: 1,000 cookie additions and synchronizations. This is critical to ensure that the contract can handle high-load scenarios without any performance degradation :zap:.

:shield: State Consistency: By repeatedly adding and syncing cookies in a rapid sequence, the test ensures that the state of the contract (i.e., the number of cookies :cookie: and their data) remains accurate and consistent. It ensures there are no race conditions or errors when handling large amounts of data :bar_chart:.

:chart_with_upwards_trend: Performance Metrics: The test logs the time :stopwatch: taken to perform the operations, allowing to identify potential performance bottlenecks :construction: or areas for optimization :bulb:.

Central Liquid stake in Stride, Quicksilver, Persistence One using Milkyway Hybrid Liquid Staking Cosmwasm Rust Smart contract

This smart contract allows users to stake their tokens, earn rewards, and participate in liquid staking. The contract also provides mechanisms for distributing both liquid tokens and redemption tokens back to stakers, with central pools managing these funds.

:card_file_box: State Definitions :card_file_box:

The contract keeps track of key data about the staking, rewards, and balances in its internal state:

  • Owner :crown:: The address of the contract’s owner. Only the owner can perform certain actions, such as distributing rewards and managing liquid/redemption pools.
  • Current Epoch :date:: Tracks the current epoch of the staking period. Epochs are generally used to define reward periods.
  • Staking Info :briefcase:: A HashMap that stores information about each staker, including the amount they’ve staked and the epoch when their stake was last updated.
  • Reward Info :moneybag:: A HashMap that stores reward information for each staker, including the total rewards earned and the last epoch in which they claimed rewards.
  • Reward Records :scroll:: A HashMap of reward records per staker, tracking their rewards over different epochs.
  • Central Pool Balances :droplet:: Separate balances are maintained for:
    • Liquid Pool :ocean:: Tokens available for distribution as liquid tokens.
    • Redemption Pool :arrows_counterclockwise:: Tokens available for distribution as redemption tokens.
    • Treasury Staking Pool :bank:: Tokens staked by users.

:speech_balloon: Message Definitions :speech_balloon:

The contract supports several ExecuteMsg messages for interacting with the staking system:

  1. StakeTokens :coin:: Allows a user to stake a specified amount of tokens.
  2. WithdrawRewards :trophy:: Allows a user to withdraw their rewards.
  3. UpdateEpoch :hourglass_flowing_sand:: Increments the current epoch, which is done periodically (by a cron job or by the contract owner).
  4. DistributeLiquidTokens :sweat_drops:: The contract owner can distribute liquid tokens to all stakers, proportional to their stake.
  5. DistributeRedemptionAmounts :recycle:: Similar to distributing liquid tokens, but this distributes redemption tokens.
  6. CentralLiquidStake :globe_with_meridians:: A command to execute central liquid staking (e.g., moving staked tokens into a liquid pool).
  7. CentralRedemption :arrows_counterclockwise:: A command to execute central redemption (e.g., converting liquid staked tokens into redeemable tokens).

:gear: Contract Functions :gear:

:one: Instantiate

The instantiate function is called when the contract is deployed. It initializes the contract’s state, setting up all required structures, including the owner, pools, and initial balances.

  • The contract is initialized by the owner, who is specified as the sender of the instantiation transaction.
  • The contract sets up empty maps to track stakers, rewards, and internal pool balances.

:two: Execute

The execute function handles all the various interactions with the contract based on the type of ExecuteMsg received. This includes staking tokens, distributing rewards, and managing the pools.

:star2: Core Functions of the Contract :star2:

:one: Staking Tokens (StakeTokens) :coin:

When a user stakes tokens, the contract:

  • :white_check_mark: Checks that the user has sent the correct amount of tokens.
  • :chart_with_upwards_trend: Updates the staker’s record in the staking_info map.
  • :bank: Increases the balance in the central_treasury_staking_pool_balance to reflect the newly staked tokens.

:speech_balloon: log:

"Staker staker1 staked 1000 tokens. Total staked in pool: 1000. Staker total stake: 1000."

:two: Withdraw Rewards (WithdrawRewards) :trophy:

When a user withdraws their rewards:

  • :bar_chart: The contract checks the staker’s reward_info.
  • :arrows_counterclockwise: Rewards are reset to zero after withdrawal.
  • :money_with_wings: Tokens are transferred to the staker from the contract’s liquid pool balance.

:speech_balloon: log:

"Staker staker1 withdrew rewards: 1000 tokens. Remaining liquid pool balance: 1000."

:three: Distribute Liquid Tokens (DistributeLiquidTokens) :sweat_drops:

The owner distributes liquid tokens to all stakers proportionally to their stake:

  • :bar_chart: The contract checks the total staked amount and distributes tokens in proportion to each staker’s share of the pool.
  • :droplet: After distribution, the tokens are deducted from the central_liquid_pool_balance.
  • :gift: Each liquid staker receives their portion of liquid tokens.

:speech_balloon: log:

"Distributed 666 liquid tokens to staker1."

:four: Distribute Redemption Tokens (DistributeRedemptionAmounts) :arrows_counterclockwise:

Similar to distributing liquid tokens, redemption tokens are distributed to stakers. These tokens may represent stakers’ ability to redeem tokens at a future date.

:speech_balloon: log:

"Distributed 333 redemption tokens to staker1."

:five: Central Liquid Stake (CentralLiquidStake)
This function simulates moving staked tokens from the treasury staking pool into the liquid pool for further operations. This represent staking tokens in another protocol (stride, quicksilver, pstake) to generate rewards/liquid tokens, which are then added to the liquid pool.

:speech_balloon: log:

"Central liquid stake executed. Added 1000 tokens to central liquid pool. New balances - Central Liquid Pool: 1000, Central Treasury Staking Pool: 500."

:six: Central Redemption (CentralRedemption) :arrows_counterclockwise:

This function simulates moving Dapp redeemable liquid tokens into the redemption pool, allowing stakers to redeem their tokens.

:speech_balloon: log:

"Central redemption executed. Added 500 tokens to central redemption pool."

:mag: Query Functions :mag:

The contract provides query functions that allow external parties to retrieve specific information about the state of the contract, such as:

  • Total Staked :briefcase:: The total amount of tokens staked by a specific user.
  • Total Rewards :trophy:: The total rewards earned by a specific user.
  • GetState :card_file_box:: Returns the entire state of the contract for inspection, useful for debugging and unit tests.

:white_check_mark: Unit Tests :white_check_mark:

The contract includes unit tests that simulate the entire lifecycle of the contract, from staking tokens to distributing liquid and redemption tokens.

  • Initialization :building_construction:: The contract is instantiated, and stakers are minted initial tokens.
  • Staking :coin:: Stakers deposit tokens, which are recorded in the contract state.
  • Central Liquid Stake and Distribution :ocean:: The owner simulates liquid staking, and then liquid tokens are distributed to the stakers proportionally.
  • Redemption :recycle:: Redemption tokens are distributed, and the contract state is queried to verify that everything works as expected.

:speech_balloon: of test results:

"Distributed total of 1000 liquid tokens. Remaining liquid pool balance: 1."

:dart: Conclusion :dart:

This contract supports a full staking lifecycle, including staking, earning rewards, liquid staking, and redemption. The central pools for liquid and redemption tokens allow for flexible reward mechanisms, and the owner can control when and how these tokens are distributed. Each function includes detailed logs :scroll: that make it easy to follow the flow of funds and ensure correctness during operations.

The smart contract is highly flexible, allowing for different staking models, and it can be extended to include additional functionalities such as reward mechanisms or token swaps between different staking pools.

Stored contract code with code_id: 1
Contract instantiated by owner
Instantiated contract at address: contract0
Minted 3000 tokens to staker1
Minted 2000 tokens to staker2
Minted 5000 tokens to contract’s balance
Initial Balances:
Staker1: 3000
Staker2: 2000
Contract: 5000
Staker staker1 staked 1000 tokens. Total staked in pool: 1000. Staker total stake: 1000.
Staker1 staked 1000 tokens.
StakeTokens Response Attributes for Staker1:
Event: execute
_contract_addr: contract0
Event: wasm
_contract_addr: contract0
action: stake_tokens
staker: staker1
amount_staked: 1000
total_staked_in_pool: 1000
staker_total_stake: 1000
Staker staker2 staked 500 tokens. Total staked in pool: 1500. Staker total stake: 500.
Staker2 staked 500 tokens.
StakeTokens Response Attributes for Staker2:
Event: execute
_contract_addr: contract0
Event: wasm
_contract_addr: contract0
action: stake_tokens
staker: staker2
amount_staked: 500
total_staked_in_pool: 1500
staker_total_stake: 500
Central Treasury Staking Pool Balance after staking: 1500
Central liquid stake executed. Added 1000 tokens to central liquid pool. New balances - Central Liquid Pool: 1000, Central Treasury Staking Pool: 500.
Executed Central Liquid Stake.
CentralLiquidStake Response Attributes:
Event: execute
_contract_addr: contract0
Event: wasm
_contract_addr: contract0
method: central_liquid_stake
amount_added: 1000
central_liquid_pool_balance: 1000
central_treasury_staking_pool_balance: 500
Distributed 666 liquid tokens to staker1.
Distributed 333 liquid tokens to staker2.
Distributed total of 1000 liquid tokens. Remaining liquid pool balance: 1.
Distributed Liquid Tokens.
DistributeLiquidTokens Response Attributes:
Event: execute
_contract_addr: contract0
Event: wasm
_contract_addr: contract0
action: distribute_liquid_tokens
remaining_liquid_pool_balance: 1
Event: transfer
recipient: staker1
sender: contract0
amount: 666token
Event: transfer
recipient: staker2
sender: contract0
amount: 333token
Balances after Liquid Token Distribution:
Staker1: 2666
Staker2: 1833
Central redemption executed. Added 500 tokens to central redemption pool. New balances - Central Redemption Pool: 500, Central Treasury Staking Pool: 0.
Executed Central Redemption.
CentralRedemption Response Attributes:
Event: execute
_contract_addr: contract0
Event: wasm
_contract_addr: contract0
method: central_redemption
amount_added: 500
central_redemption_pool_balance: 500
central_treasury_staking_pool_balance: 0
Distributed 333 redemption tokens to staker1.
Distributed 166 redemption tokens to staker2.
Distributed total of 500 redemption tokens. Remaining redemption pool balance: 1.
Distributed Redemption Amounts.
DistributeRedemptionAmounts Response Attributes:
Event: execute
_contract_addr: contract0
Event: wasm
_contract_addr: contract0
action: distribute_redemption_amounts
remaining_redemption_pool_balance: 1
Event: transfer
recipient: staker1
sender: contract0
amount: 333token
Event: transfer
recipient: staker2
sender: contract0
amount: 166token
Balances after Redemption Distribution:
Staker1: 2999
Staker2: 1999
Final State of the Contract:
State {
owner: Addr(
“owner”,
),
current_epoch: 0,
staking_info: {
“staker2”: StakeInfo {
amount: Uint128(
500,
),
last_updated_epoch: 0,
},
“staker1”: StakeInfo {
amount: Uint128(
1000,
),
last_updated_epoch: 0,
},
},
reward_info: {},
reward_records: {},
total_liquid_tokens: Uint128(
0,
),
total_redemption_tokens: Uint128(
0,
),
contract_addresses: ,
central_liquid_pool_balance: Uint128(
1,
),
central_redemption_pool_balance: Uint128(
1,
),
central_treasury_staking_pool_balance: Uint128(
0,
),
}
Contract’s final balance: 5002
Staker1 received 666 tokens from Liquid Distribution.
Staker2 received 333 tokens from Liquid Distribution.
Staker1 received 333 tokens from Redemption Distribution.
Staker2 received 166 tokens from Redemption Distribution.
Final Balances:
Staker1: 2999
Staker2: 1999
Contract: 5002

1 Like