Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/EntropyDeployments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export const EntropyDeployments: Record<string, EntropyDeployment> = {
"berachain-testnet-v2": {
rpc: "https://evm-rpc-bera.rhino-apis.com/",
network: "testnet",
delay: "",
delay: "https://bartio.beratrail.io/address/$ADDRESS",
address: "0x36825bf3Fbdf5a29E2d5148bfe7Dcf7B5639e320",
explorer: "",
gasLimit: "500K",
Expand Down Expand Up @@ -236,7 +236,7 @@ export const EntropyDeployments: Record<string, EntropyDeployment> = {
address: "0x23f0e8FAeE7bbb405E7A7C3d60138FCfd43d7509",
explorer: "https://testnet-explorer.etherlink.com/address/$ADDRESS",
delay: "",
gasLimit: "500K",
gasLimit: "15M",
network: "testnet",
rpc: "https://node.ghostnet.etherlink.com",
},
Expand Down
15 changes: 15 additions & 0 deletions pages/entropy/best-practices.mdx
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Best Practices

## Limit gas usage on the callback

Keeping the callback function simple is crucial because the entropy providers limit gas usage.
This ensures gas usage is predictable and consistent, avoiding potential issues with the callback.

For example, if you want to use entropy to generate a random number for each player in a round of game,
you need to make sure that the callback function works for the maximum number of players that can be in each round.
Otherwise, the callbacks will work for some rounds with fewer players, but will fail for rounds with more players.

Multiple solutions are possible to address this problem. You can store the random number received from the callback and
either ask users to submit more transactions after the callback to continue the flow or run a background crank service
to submit the necessary transactions.

The gas limit for each chain is listed on the [contract addresses](./contract-addresses) page.

## Generating random values within a specific range

You can map the random number provided by Entropy into a smaller range using the solidity [modulo operator](https://docs.soliditylang.org/en/latest/types.html#modulo).
Expand Down