aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
authorGreg Hysen <greg.hysen@gmail.com>2018-12-04 06:48:10 +0800
committerGreg Hysen <greg.hysen@gmail.com>2018-12-19 05:36:05 +0800
commit16bd0ce7ec834029b5a6e8aa308c1d52ce6130ea (patch)
tree8568fbfe81783db799977a6c89b32c9ef39c777d /packages
parent61a906e9e774b40cb1c1053005fef98aa1cc7c85 (diff)
downloaddexon-sol-tools-16bd0ce7ec834029b5a6e8aa308c1d52ce6130ea.tar.gz
dexon-sol-tools-16bd0ce7ec834029b5a6e8aa308c1d52ce6130ea.tar.zst
dexon-sol-tools-16bd0ce7ec834029b5a6e8aa308c1d52ce6130ea.zip
generalized KYC extension passing all tests
Diffstat (limited to 'packages')
-rw-r--r--packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol12
-rw-r--r--packages/contracts/test/extensions/compliant_forwarder.ts8
-rw-r--r--packages/types/src/index.ts1
3 files changed, 16 insertions, 5 deletions
diff --git a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol b/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
index 27c578eae..b79d8db54 100644
--- a/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
+++ b/packages/contracts/contracts/extensions/CompliantForwarder/CompliantForwarder.sol
@@ -127,13 +127,23 @@ contract CompliantForwarder is ExchangeSelectors{
0x20 // reserve space for return balance (0x20 bytes)
)
if eq(success, 0) {
+ // Revert with `Error("BALANCE_CHECK_FAILED")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000001453454e4445525f4e4f545f415554484f52495a454400000000000000)
+ mstore(96, 0)
revert(0, 100)
}
// Revert if balance not held
let addressBalance := mload(newMemFreePtr)
if eq(addressBalance, 0) {
- revert(0, 100)
+ // Revert with `Error("AT_LEAST_ONE_ADDRESS_HAS_ZERO_BALANCE")`
+ mstore(0, 0x08c379a000000000000000000000000000000000000000000000000000000000)
+ mstore(32, 0x0000002000000000000000000000000000000000000000000000000000000000)
+ mstore(64, 0x0000002541545f4c454153545f4f4e455f414444524553535f4841535f5a4552)
+ mstore(96, 0x4f5f42414c414e43450000000000000000000000000000000000000000000000)
+ revert(0, 109)
}
}
diff --git a/packages/contracts/test/extensions/compliant_forwarder.ts b/packages/contracts/test/extensions/compliant_forwarder.ts
index 4eedffe05..639893798 100644
--- a/packages/contracts/test/extensions/compliant_forwarder.ts
+++ b/packages/contracts/test/extensions/compliant_forwarder.ts
@@ -210,7 +210,7 @@ describe.only(ContractName.CompliantForwarder, () => {
beforeEach(async () => {
erc20Balances = await erc20Wrapper.getBalancesAsync();
});
- it.only('should transfer the correct amounts when maker and taker are compliant', async () => {
+ it('should transfer the correct amounts when maker and taker are compliant', async () => {
const txHash = await compliantForwarderInstance.executeTransaction.sendTransactionAsync(
compliantSignedFillOrderTx.salt,
compliantSignedFillOrderTx.signerAddress,
@@ -302,10 +302,10 @@ describe.only(ContractName.CompliantForwarder, () => {
compliantSignedFillOrderTx.data,
compliantSignedFillOrderTx.signature,
),
- RevertReason.TakerUnverified
+ RevertReason.AtLeastOneAddressHasZeroBalance
);
});
- it.only('should revert if maker address is not compliant (does not hold a Yes Token)', async () => {
+ it('should revert if maker address is not compliant (does not hold a Yes Token)', async () => {
// Create signed order with non-compliant maker address
const signedOrderWithBadMakerAddress = await orderFactory.newSignedOrderAsync({
senderAddress: compliantForwarderInstance.address,
@@ -330,7 +330,7 @@ describe.only(ContractName.CompliantForwarder, () => {
signedFillOrderTx.data,
signedFillOrderTx.signature,
),
- RevertReason.MakerUnverified
+ RevertReason.AtLeastOneAddressHasZeroBalance
);
});
});
diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
index 0c6fd7fd7..022b24e70 100644
--- a/packages/types/src/index.ts
+++ b/packages/types/src/index.ts
@@ -245,6 +245,7 @@ export enum RevertReason {
InvalidAssetData = 'INVALID_ASSET_DATA',
MakerUnverified = 'MAKER_UNVERIFED',
TakerUnverified = 'TAKER_UNVERIFIED',
+ AtLeastOneAddressHasZeroBalance = 'AT_LEAST_ONE_ADDRESS_HAS_ZERO_BALANCE',
}
export enum StatusCodes {