Skip to content

Commit

Permalink
feat: upgrade solidity version; feat: replace block.difficulty with p…
Browse files Browse the repository at this point in the history
…revrandao
  • Loading branch information
yk-saito committed Aug 6, 2023
1 parent 98b37db commit 74a6a53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/contract/contracts/WavePortal.sol
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.17;
pragma solidity ^0.8.18;

import 'hardhat/console.sol';

Expand Down Expand Up @@ -29,7 +29,7 @@ contract WavePortal {
/*
* 初期シードの設定
*/
_seed = (block.timestamp + block.difficulty) % 100;
_seed = (block.timestamp + block.prevrandao) % 100;
}

function wave(string memory _message) public {
Expand All @@ -49,7 +49,7 @@ contract WavePortal {
/*
* ユーザーのために乱数を設定
*/
_seed = (block.difficulty + block.timestamp + _seed) % 100;
_seed = (block.prevrandao + block.timestamp + _seed) % 100;

_waves.push(Wave(msg.sender, _message, block.timestamp, _seed));

Expand Down
2 changes: 1 addition & 1 deletion packages/contract/hardhat.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ require('dotenv').config();
const { PRIVATE_KEY, STAGING_ALCHEMY_KEY } = process.env;

module.exports = {
solidity: '0.8.17',
solidity: '0.8.18',
networks: {
sepolia: {
url: STAGING_ALCHEMY_KEY || '',
Expand Down

0 comments on commit 74a6a53

Please sign in to comment.