Add public wrappers for libs

This commit is contained in:
Amir Bandeali 2019-02-01 14:00:48 -08:00
parent 1166b6c2fb
commit 7a1e6cccfd
6 changed files with 59 additions and 3 deletions

View File

@ -18,5 +18,5 @@
} }
} }
}, },
"contracts": ["TEC"] "contracts": ["TEC", "TestLibs"]
} }

View File

@ -0,0 +1,53 @@
/*
Copyright 2018 ZeroEx Intl.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
pragma solidity ^0.5.2;
pragma experimental "ABIEncoderV2";
import "../src/libs/LibTECApproval.sol";
import "../src/libs/LibZeroExTransaction.sol";
contract TestLibs is
LibTECApproval,
LibZeroExTransaction
{
/// @dev Calculated the EIP712 hash of the TEC approval mesasage using the domain separator of this contract.
/// @param approval TEC approval message containing the transaction hash, transaction signature, and expiration of the approval.
/// @return EIP712 hash of the TEC approval message with the domain separator of this contract.
function publicGetTECApprovalHash(TECApproval memory approval)
public
view
returns (bytes32 approvalHash)
{
approvalHash = getTECApprovalHash(approval);
return approvalHash;
}
/// @dev Calculates the EIP712 hash of a 0x transaction using the domain separator of this contract.
/// @param transaction 0x transaction containing salt, signerAddress, and data.
/// @return EIP712 hash of the transaction with the domain separator of this contract.
function publicGetTransactionHash(ZeroExTransaction memory transaction)
public
view
returns (bytes32 transactionHash)
{
transactionHash = getTransactionHash(transaction);
return transactionHash;
}
}

View File

@ -32,7 +32,7 @@
"lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol" "lint-contracts": "solhint -c ../.solhint.json contracts/**/**/**/**/*.sol"
}, },
"config": { "config": {
"abis": "generated-artifacts/@(TEC).json" "abis": "generated-artifacts/@(TEC|TestLibs).json"
}, },
"repository": { "repository": {
"type": "git", "type": "git",

View File

@ -1,7 +1,9 @@
import { ContractArtifact } from 'ethereum-types'; import { ContractArtifact } from 'ethereum-types';
import * as TEC from '../../generated-artifacts/TEC.json'; import * as TEC from '../../generated-artifacts/TEC.json';
import * as TestLibs from '../../generated-artifacts/TestLibs.json';
export const artifacts = { export const artifacts = {
TEC: TEC as ContractArtifact, TEC: TEC as ContractArtifact,
TestLibs: TestLibs as ContractArtifact,
}; };

View File

@ -1 +1,2 @@
export * from '../../generated-wrappers/tec'; export * from '../../generated-wrappers/tec';
export * from '../../generated-wrappers/test_libs';

View File

@ -6,6 +6,6 @@
"resolveJsonModule": true "resolveJsonModule": true
}, },
"include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"], "include": ["./src/**/*", "./test/**/*", "./generated-wrappers/**/*"],
"files": ["./generated-artifacts/TEC.json"], "files": ["./generated-artifacts/TEC.json", "./generated-artifacts/TestLibs.json"],
"exclude": ["./deploy/solc/solc_bin"] "exclude": ["./deploy/solc/solc_bin"]
} }