Skip to content

Commit

Permalink
chore: rename contract
Browse files Browse the repository at this point in the history
  • Loading branch information
tringuyenskymavis committed Jun 13, 2024
1 parent 16a4f36 commit 55df959
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 0 deletions.
19 changes: 19 additions & 0 deletions script/contracts/token/RoninMockERC1155Deploy.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
pragma solidity ^0.8.19;

import { RoninMockERC1155 } from "@ronin/contracts/mocks/token/RoninMockERC1155.sol";

import { Contract } from "../../utils/Contract.sol";
import { ISharedArgument } from "../../interfaces/ISharedArgument.sol";
import { Migration } from "../../Migration.s.sol";

contract RoninMockERC1155Deploy is Migration {
function _defaultArguments() internal virtual override returns (bytes memory args) {
ISharedArgument.RoninMockERC1155Param memory param = config.sharedArguments().mockErc1155;

args = abi.encode(param.defaultAdmin, param.uri, param.name, param.symbol);
}

function run() public virtual returns (RoninMockERC1155) {
return RoninMockERC1155(_deployImmutable(Contract.RoninMockERC1155.key()));
}
}
57 changes: 57 additions & 0 deletions src/mocks/token/RoninMockERC1155.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.0;

import "@openzeppelin/contracts/token/ERC1155/extensions/ERC1155Burnable.sol";
import "@openzeppelin/contracts/access/AccessControl.sol";

contract RoninMockERC1155 is ERC1155Burnable, AccessControl {
// Token name
string internal _name;
// Token symbol
string internal _symbol;

bytes32 public constant MINTER_ROLE = keccak256("MINTER_ROLE");
bytes32 public constant BURNER_ROLE = keccak256("BURNER_ROLE");

constructor(address defaultAdmin, string memory uri, string memory name, string memory symbol) ERC1155(uri) {
_name = name;
_symbol = symbol;
_grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);
}

function mint(address account, uint256 id, uint256 amount, bytes memory data) public onlyRole(MINTER_ROLE) {
_mint(account, id, amount, data);
}

function mintBatch(address to, uint256[] memory ids, uint256[] memory amounts, bytes memory data)
public
onlyRole(MINTER_ROLE)
{
_mintBatch(to, ids, amounts, data);
}

function burn(address from, uint256 id, uint256 value) public override onlyRole(BURNER_ROLE) {
_burn(from, id, value);
}

function burnBatch(address from, uint256[] memory ids, uint256[] memory amounts)
public
override
onlyRole(BURNER_ROLE)
{
_burnBatch(from, ids, amounts);
}

function name() public view returns (string memory) {
return _name;
}

function symbol() public view returns (string memory) {
return _symbol;
}

function supportsInterface(bytes4 interfaceId) public view override(ERC1155, AccessControl) returns (bool) {
return ERC1155.supportsInterface(interfaceId) || AccessControl.supportsInterface(interfaceId);
}
}

0 comments on commit 55df959

Please sign in to comment.