Skip to content

fix: contract constructor & tabs #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 17, 2024
Merged
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
27 changes: 18 additions & 9 deletions pages/entropy/generate-random-numbers/evm.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,14 @@ import { IEntropyConsumer } from "@pythnetwork/entropy-sdk-solidity/IEntropyCons
import { IEntropy } from "@pythnetwork/entropy-sdk-solidity/IEntropy.sol";

// @param entropyAddress The address of the entropy contract.
contract YourContract(address entropyAddress) is IEntropyConsumer {
IEntropy entropy = IEntropy(entropyAddress);
contract YourContract is IEntropyConsumer {
IEntropy public entropy;

constructor(address entropyAddress) {
entropy = IEntropy(entropyAddress);
}
}

```

<Callout type="info">
Expand Down Expand Up @@ -76,14 +81,18 @@ To generate a random number, follow these steps.

Generate a 32-byte random number on the client side.

<Tabs items={["web3.js", "ethers.js"]}>
<Tabs.Tab>
```typescript copy const userRandomNumber = web3.utils.randomHex(32); ```
</Tabs.Tab>
<Tabs.Tab>
```typescript copy const userRandomNumber = ethers.utils.randomBytes(32);
<Tabs>
<TabItem value="web3.js" label="web3.js">
```javascript
const userRandomNumber = web3.utils.randomHex(32);
```
</TabItem>

<TabItem value="ethers.js" label="ethers.js">
```javascript
const userRandomNumber = ethers.utils.randomBytes(32);
```
</Tabs.Tab>
</TabItem>
</Tabs>

### 2. Request a number from Entropy
Expand Down
Loading