Skip to content

Commit

Permalink
Add HBR token
Browse files Browse the repository at this point in the history
  • Loading branch information
SigismundSchlomo committed Sep 23, 2024
1 parent 1178873 commit 29761c6
Show file tree
Hide file tree
Showing 4 changed files with 87 additions and 0 deletions.
21 changes: 21 additions & 0 deletions contracts/staking/token/HBRToken.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.0;

import "@openzeppelin/contracts/access/AccessControl.sol";
import "@openzeppelin/contracts/token/ERC20/ERC20.sol";

contract HBRToken is ERC20, AccessControl {
bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE"); // can use mint / burn methods

constructor(address admin) ERC20("Harbor", "HBR") {
_grantRole(DEFAULT_ADMIN_ROLE, admin);
}

function mint(address account, uint256 amount) external onlyRole(MINTER_ROLE) {
_mint(account, amount);
}

function burn(address account, uint256 amount) external onlyRole(MINTER_ROLE) {
_burn(account, amount);
}
}
34 changes: 34 additions & 0 deletions deployments/22040.json
Original file line number Diff line number Diff line change
Expand Up @@ -1662,5 +1662,39 @@
"implementation": "0x7184DD655aacCCb28376Fa1B59e3712566Df670b",
"fullyQualifiedName": "@openzeppelin/contracts/proxy/ERC1967/ERC1967Proxy.sol:ERC1967Proxy"
}
},
"Ecosystem_HRBToken": {
"address": "0xCB856833c615ef09Ba779D35D663b849aD23C957",
"abi": [
"constructor(address admin)",
"event Approval(address indexed owner, address indexed spender, uint256 value)",
"event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole)",
"event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender)",
"event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender)",
"event Transfer(address indexed from, address indexed to, uint256 value)",
"function DEFAULT_ADMIN_ROLE() view returns (bytes32)",
"function MINTER_ROLE() view returns (bytes32)",
"function allowance(address owner, address spender) view returns (uint256)",
"function approve(address spender, uint256 amount) returns (bool)",
"function balanceOf(address account) view returns (uint256)",
"function burn(address account, uint256 amount)",
"function decimals() view returns (uint8)",
"function decreaseAllowance(address spender, uint256 subtractedValue) returns (bool)",
"function getRoleAdmin(bytes32 role) view returns (bytes32)",
"function grantRole(bytes32 role, address account)",
"function hasRole(bytes32 role, address account) view returns (bool)",
"function increaseAllowance(address spender, uint256 addedValue) returns (bool)",
"function mint(address account, uint256 amount)",
"function name() view returns (string)",
"function renounceRole(bytes32 role, address account)",
"function revokeRole(bytes32 role, address account)",
"function supportsInterface(bytes4 interfaceId) view returns (bool)",
"function symbol() view returns (string)",
"function totalSupply() view returns (uint256)",
"function transfer(address to, uint256 amount) returns (bool)",
"function transferFrom(address from, address to, uint256 amount) returns (bool)"
],
"deployTx": "0x1c7a3ff3e00b95e2e01212a0078613ee807a28591b9a2024060e6c6d68fadfe9",
"fullyQualifiedName": "contracts/staking/token/HBRToken.sol:HBRToken"
}
}
31 changes: 31 additions & 0 deletions scripts/ecosystem/token_staking/deploy_hbr.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ethers } from "hardhat";
import { ContractNames } from "../../../src";
import { deploy } from "@airdao/deployments/deploying";
import { HBRToken__factory } from "../../../typechain-types";

async function main() {
const {chainId} = await ethers.provider.getNetwork();
const [deployer] = await ethers.getSigners();

if (chainId == 16718) {
return;
}

const airBond = await deploy<HBRToken__factory>({
contractName: ContractNames.Ecosystem_HRBToken,
artifactName: "HBRToken",
deployArgs: [deployer.address],
signer: deployer,
loadIfAlreadyDeployed: true,
});

await airBond.grantRole(await airBond.DEFAULT_ADMIN_ROLE(), deployer.address); //
await airBond.grantRole(await airBond.MINTER_ROLE(), deployer.address);
}

if (require.main === module) {
main().catch((error) => {
console.error(error);
process.exitCode = 1;
});
}
1 change: 1 addition & 0 deletions src/contracts/names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ export enum ContractNames {
Ecosystem_TokenPoolsManager = "Ecosystem_TokenPoolsManager",
Ecosystem_TokenPoolsManagerMultisig = "Ecosystem_TokenPoolsManager_Multisig",
Ecosystem_TokenPoolsManagerRewardsBank = "Ecosystem_TokenPoolsManager_RewardsBank",
Ecosystem_HRBToken = "Ecosystem_HRBToken",
}

export const MULTISIGS_COMMON = {
Expand Down

0 comments on commit 29761c6

Please sign in to comment.