Skip to content

Commit

Permalink
ValorizeDAO#15: add merkle root check
Browse files Browse the repository at this point in the history
  • Loading branch information
javier123454321 committed Dec 20, 2021
1 parent e664511 commit ce072cd
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions contracts/SimpleToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pragma solidity 0.8.6;

import "./@openzeppelin/contracts/token/ERC20/ERC20.sol";
import "./@openzeppelin/contracts/access/AccessControl.sol";
import "./@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
//import "hardhat/console.sol";

/**
Expand All @@ -12,6 +13,9 @@ import "./@openzeppelin/contracts/access/AccessControl.sol";
*/
contract SimpleToken is ERC20, AccessControl {
uint256 immutable initialSupply;
bytes32 public merkleRoot;

event MerkleRootChanged(bytes32 merkleRoot);

/**
* @dev Constructor.
Expand Down Expand Up @@ -41,4 +45,10 @@ contract SimpleToken is ERC20, AccessControl {
function getInitialSupply() public view returns (uint256) {
return initialSupply;
}

function setMerkleRoot(bytes32 _merkleRoot) external onlyRole(DEFAULT_ADMIN_ROLE) {
require(merkleRoot == bytes32(0), "Merkle root already set");
merkleRoot = _merkleRoot;
emit MerkleRootChanged(_merkleRoot);
}
}

0 comments on commit ce072cd

Please sign in to comment.