You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To increase the chance of players earning rewards, we should increase the number of players rewarded from 3 to 10. To achieve this, we will need to switch from the current distribution system which is doing immediate token transfers to having the contract escrow the funds.
An erc20 is typically 4 storage updates (because most SN erc20s are using u256 which requires 2 felts) so paying the top three players is 12 storage updates. If instead we simply updated the claimable balance of an adventurer id, we could pay the top 12 players for approximately the same amount of gas.
The UX of this would also be improved because instead of the user tx being a bunch of token transfers as it is now, it would be a single transfer moving the $lords into the LS contract. The LS contract would then update claimable balances internally.
Contract Changes:
When processing payment, LS will transfer the 3$ in lords from the player into the contract.
Add a storage for reward_balance(adventurer_id) which is incremented when player receives additional rewards, instead of doing erc20 transfers.
Add a claim_rewards(Array<adventurer_id>) to the contract which allows the owner of an adventurer to claim their rewards.
Add events to power client. I think we can reuse the current RewardDetails event but then we also need a "ClaimedRewards" event, with the adventurer_id
Add a "Claim all" button to the client
The text was updated successfully, but these errors were encountered:
To increase the chance of players earning rewards, we should increase the number of players rewarded from 3 to 10. To achieve this, we will need to switch from the current distribution system which is doing immediate token transfers to having the contract escrow the funds.
An erc20 is typically 4 storage updates (because most SN erc20s are using u256 which requires 2 felts) so paying the top three players is 12 storage updates. If instead we simply updated the claimable balance of an adventurer id, we could pay the top 12 players for approximately the same amount of gas.
The UX of this would also be improved because instead of the user tx being a bunch of token transfers as it is now, it would be a single transfer moving the $lords into the LS contract. The LS contract would then update claimable balances internally.
Contract Changes:
reward_balance(adventurer_id)
which is incremented when player receives additional rewards, instead of doing erc20 transfers.claim_rewards(Array<adventurer_id>)
to the contract which allows the owner of an adventurer to claim their rewards.Add a "Claim all" button to the client
The text was updated successfully, but these errors were encountered: