Skip to content

Commit

Permalink
Update files to include mocks (#503)
Browse files Browse the repository at this point in the history
  • Loading branch information
mshakeg authored Oct 22, 2023
1 parent 85a0600 commit 11c5017
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@
"description": "Hedera Smart Contract Service supporting files",
"files": [
"/contracts/**/*.sol",
"/contracts/**/**/**/*.sol"
"/contracts/**/**/**/*.sol",
"/test/foundry/mocks/**/*.sol",
"/test/foundry/mocks/**/**/**/*.sol"
],
"repository": {
"type": "git",
Expand Down
11 changes: 9 additions & 2 deletions test/foundry/mocks/hts-precompile/HtsSystemContractMock.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.9;

import 'forge-std/console.sol';

import '../../../../contracts/hts-precompile/HederaResponseCodes.sol';
import '../../../../contracts/hts-precompile/KeyHelper.sol';
import './HederaFungibleToken.sol';
Expand Down Expand Up @@ -45,6 +43,11 @@ contract HtsSystemContractMock is NoDelegateCall, KeyHelper, IHtsPrecompileMock
// HTS token -> paused
mapping(address => TokenConfig) internal _tokenPaused;

// - - - - - - EVENTS - - - - - -

// emitted for convenience of having the token address accessible in a Hardhat environment
event TokenCreated(address indexed token);

constructor() NoDelegateCall(HTS_PRECOMPILE) {}

// peripheral internal helpers:
Expand Down Expand Up @@ -1224,6 +1227,7 @@ contract HtsSystemContractMock is NoDelegateCall, KeyHelper, IHtsPrecompileMock

/// @dev no need to register newly created HederaFungibleToken in this context as the constructor will call HtsSystemContractMock#registerHederaFungibleToken
HederaFungibleToken hederaFungibleToken = new HederaFungibleToken(fungibleTokenInfo);
emit TokenCreated(address(hederaFungibleToken));
return (HederaResponseCodes.SUCCESS, address(hederaFungibleToken));
}

Expand All @@ -1240,6 +1244,7 @@ contract HtsSystemContractMock is NoDelegateCall, KeyHelper, IHtsPrecompileMock

/// @dev no need to register newly created HederaNonFungibleToken in this context as the constructor will call HtsSystemContractMock#registerHederaNonFungibleToken
HederaNonFungibleToken hederaNonFungibleToken = new HederaNonFungibleToken(tokenInfo);
emit TokenCreated(address(hederaNonFungibleToken));
return (HederaResponseCodes.SUCCESS, address(hederaNonFungibleToken));
}

Expand Down Expand Up @@ -1269,6 +1274,7 @@ contract HtsSystemContractMock is NoDelegateCall, KeyHelper, IHtsPrecompileMock

/// @dev no need to register newly created HederaFungibleToken in this context as the constructor will call HtsSystemContractMock#registerHederaFungibleToken
HederaFungibleToken hederaFungibleToken = new HederaFungibleToken(fungibleTokenInfo);
emit TokenCreated(address(hederaFungibleToken));
return (HederaResponseCodes.SUCCESS, address(hederaFungibleToken));
}

Expand All @@ -1290,6 +1296,7 @@ contract HtsSystemContractMock is NoDelegateCall, KeyHelper, IHtsPrecompileMock

/// @dev no need to register newly created HederaNonFungibleToken in this context as the constructor will call HtsSystemContractMock#registerHederaNonFungibleToken
HederaNonFungibleToken hederaNonFungibleToken = new HederaNonFungibleToken(tokenInfo);
emit TokenCreated(address(hederaNonFungibleToken));
return (HederaResponseCodes.SUCCESS, address(hederaNonFungibleToken));
}

Expand Down

0 comments on commit 11c5017

Please sign in to comment.