aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-05 07:23:25 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-12-19 05:36:05 +0800
commit1cdd82178ff630827095e778a222fafa4161969e (patch)
tree2ff0d2295310e835359c90344a0420b930842609
parentdbf1de2e691743672fa4918e7ab0f1e3948401f1 (diff)
downloaddexon-sol-tools-1cdd82178ff630827095e778a222fafa4161969e.tar
dexon-sol-tools-1cdd82178ff630827095e778a222fafa4161969e.tar.gz
dexon-sol-tools-1cdd82178ff630827095e778a222fafa4161969e.tar.bz2
dexon-sol-tools-1cdd82178ff630827095e778a222fafa4161969e.tar.lz
dexon-sol-tools-1cdd82178ff630827095e778a222fafa4161969e.tar.xz
dexon-sol-tools-1cdd82178ff630827095e778a222fafa4161969e.tar.zst
dexon-sol-tools-1cdd82178ff630827095e778a222fafa4161969e.zip
ComplianceForwarder renamed to BalanceThresholdFilter
-rw-r--r--contracts/test-utils/src/types.ts2
-rw-r--r--packages/contracts/contracts/extensions/BalanceThresholdFilter/BalanceThresholdFilter.sol (renamed from packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol)18
-rw-r--r--packages/contracts/contracts/extensions/BalanceThresholdFilter/interfaces/IThresholdAsset.sol30
-rw-r--r--packages/contracts/test/extensions/balance_threshold_filter.ts (renamed from packages/contracts/test/extensions/compliant_forwarder.ts)16
4 files changed, 48 insertions, 18 deletions
diff --git a/contracts/test-utils/src/types.ts b/contracts/test-utils/src/types.ts
index 46b7ad941..cbdd513eb 100644
--- a/contracts/test-utils/src/types.ts
+++ b/contracts/test-utils/src/types.ts
@@ -105,7 +105,7 @@ export enum ContractName {
Authorizable = 'Authorizable',
Whitelist = 'Whitelist',
Forwarder = 'Forwarder',
- CompliantForwarder = 'CompliantForwarder',
+ BalanceThresholdFilter = 'BalanceThresholdFilter',
}
export interface SignedTransaction {
diff --git a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol b/packages/contracts/contracts/extensions/BalanceThresholdFilter/BalanceThresholdFilter.sol
index d33f4f398..93b63eb52 100644
--- a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
+++ b/packages/contracts/contracts/extensions/BalanceThresholdFilter/BalanceThresholdFilter.sol
@@ -20,26 +20,26 @@ pragma solidity 0.4.24;
pragma experimental ABIEncoderV2;
import "../../protocol/Exchange/interfaces/IExchange.sol";
-import "../../tokens/ERC721Token/IERC721Token.sol";
import "../../utils/LibBytes/LibBytes.sol";
import "../../utils/ExchangeSelectors/ExchangeSelectors.sol";
+import "./interfaces/IThresholdAsset.sol";
-contract CompliantForwarder is ExchangeSelectors{
+contract BalanceThresholdFilter is ExchangeSelectors {
using LibBytes for bytes;
IExchange internal EXCHANGE;
- IERC721Token internal COMPLIANCE_TOKEN;
+ IThresholdAsset internal THRESHOLD_ASSET;
event ValidatedAddresses (
address[] addresses
);
- constructor(address exchange, address complianceToken)
+ constructor(address exchange, address thresholdAsset)
public
{
EXCHANGE = IExchange(exchange);
- COMPLIANCE_TOKEN = IERC721Token(complianceToken);
+ THRESHOLD_ASSET = IThresholdAsset(thresholdAsset);
}
function executeTransaction(
@@ -257,16 +257,16 @@ contract CompliantForwarder is ExchangeSelectors{
mstore(0x40, freeMemPtr)
// Validate addresses
- let complianceTokenAddress := sload(COMPLIANCE_TOKEN_slot)
+ let thresholdAssetAddress := sload(THRESHOLD_ASSET_slot)
for {let addressToValidate := addressesToValidateElementPtr} lt(addressToValidate, addressesToValidateElementEndPtr) {addressToValidate := add(addressToValidate, 0x20)} {
- // Construct calldata for `COMPLIANCE_TOKEN.balanceOf`
+ // Construct calldata for `THRESHOLD_ASSET.balanceOf`
mstore(freeMemPtr, 0x70a0823100000000000000000000000000000000000000000000000000000000)
mstore(add(4, freeMemPtr), mload(addressToValidate))
- // call `COMPLIANCE_TOKEN.balanceOf`
+ // call `THRESHOLD_ASSET.balanceOf`
let success := call(
gas, // forward all gas
- complianceTokenAddress, // call address of asset proxy
+ thresholdAssetAddress, // call address of asset proxy
0, // don't send any ETH
freeMemPtr, // pointer to start of input
0x24, // length of input (one padded address)
diff --git a/packages/contracts/contracts/extensions/BalanceThresholdFilter/interfaces/IThresholdAsset.sol b/packages/contracts/contracts/extensions/BalanceThresholdFilter/interfaces/IThresholdAsset.sol
new file mode 100644
index 000000000..61acaba0a
--- /dev/null
+++ b/packages/contracts/contracts/extensions/BalanceThresholdFilter/interfaces/IThresholdAsset.sol
@@ -0,0 +1,30 @@
+/*
+
+ 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.4.24;
+
+contract IThresholdAsset {
+
+ /// @param _owner The address from which the balance will be retrieved
+ /// @return Balance of owner
+ function balanceOf(address _owner)
+ external
+ view
+ returns (uint256);
+
+} \ No newline at end of file
diff --git a/packages/contracts/test/extensions/compliant_forwarder.ts b/packages/contracts/test/extensions/balance_threshold_filter.ts
index 196167264..50fd79439 100644
--- a/packages/contracts/test/extensions/compliant_forwarder.ts
+++ b/packages/contracts/test/extensions/balance_threshold_filter.ts
@@ -9,7 +9,7 @@ import * as _ from 'lodash';
import { DummyERC20TokenContract } from '../../generated-wrappers/dummy_erc20_token';
import { ExchangeContract } from '../../generated-wrappers/exchange';
-import { CompliantForwarderContract } from '../../generated-wrappers/compliant_forwarder';
+import { BalanceThresholdFilterContract } from '../../generated-wrappers/balance_threshold_filter';
import { YesComplianceTokenContract } from '../../generated-wrappers/yes_compliance_token';
import { artifacts } from '../../src/artifacts';
@@ -37,7 +37,7 @@ const expect = chai.expect;
const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper);
const DECIMALS_DEFAULT = 18;
-describe.only(ContractName.CompliantForwarder, () => {
+describe.only(ContractName.BalanceThresholdFilter, () => {
let compliantMakerAddress: string;
let owner: string;
let compliantTakerAddress: string;
@@ -63,7 +63,7 @@ describe.only(ContractName.CompliantForwarder, () => {
const makerAssetAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(1000), DECIMALS_DEFAULT);
const takerAssetFillAmount = Web3Wrapper.toBaseUnitAmount(new BigNumber(250), DECIMALS_DEFAULT);
- let compliantForwarderInstance: CompliantForwarderContract;
+ let compliantForwarderInstance: BalanceThresholdFilterContract;
before(async () => {
// Create accounts
@@ -126,15 +126,15 @@ describe.only(ContractName.CompliantForwarder, () => {
const privateKey = constants.TESTRPC_PRIVATE_KEYS[accounts.indexOf(compliantMakerAddress)];
orderFactory = new OrderFactory(privateKey, defaultOrderParams);
// Deploy Compliant Forwarder
- compliantForwarderInstance = await CompliantForwarderContract.deployFrom0xArtifactAsync(
- artifacts.CompliantForwarder,
+ compliantForwarderInstance = await BalanceThresholdFilterContract.deployFrom0xArtifactAsync(
+ artifacts.BalanceThresholdFilter,
provider,
txDefaults,
exchangeInstance.address,
yesTokenInstance.address,
);
/*
- const compliantForwarderContract = new CompliantForwarderContract(
+ const compliantForwarderContract = new BalanceThresholdFilterContract(
compliantForwarderInstance.abi,
compliantForwarderInstance.address,
provider,
@@ -272,9 +272,9 @@ describe.only(ContractName.CompliantForwarder, () => {
});
it('should revert if senderAddress is not set to the compliant forwarding contract', async () => {
// Create signed order with incorrect senderAddress
- const notCompliantForwarderAddress = zrxToken.address;
+ const notBalanceThresholdFilterAddress = zrxToken.address;
const signedOrderWithBadSenderAddress = await orderFactory.newSignedOrderAsync({
- senderAddress: notCompliantForwarderAddress,
+ senderAddress: notBalanceThresholdFilterAddress,
});
const signedOrderWithoutExchangeAddress = orderUtils.getOrderWithoutExchangeAddress(
signedOrderWithBadSenderAddress,