diff --git a/packages/@erc-3643/core/src/transfer-compliance.test.ts b/packages/@erc-3643/core/src/transfer-compliance.test.ts index 0403367..507ed2d 100644 --- a/packages/@erc-3643/core/src/transfer-compliance.test.ts +++ b/packages/@erc-3643/core/src/transfer-compliance.test.ts @@ -16,6 +16,7 @@ const isEnoughSpendableBalance: any = jest.fn(); const implToken = { identityRegistry: jest.fn(), compliance: jest.fn(), + decimals: jest.fn(), areTransferPartiesFrozen, isEnoughSpendableBalance }; diff --git a/packages/@erc-3643/core/src/transfer-compliance.ts b/packages/@erc-3643/core/src/transfer-compliance.ts index e613b8f..95ed096 100644 --- a/packages/@erc-3643/core/src/transfer-compliance.ts +++ b/packages/@erc-3643/core/src/transfer-compliance.ts @@ -29,6 +29,13 @@ export class TransferCompliance { const compliance = this.complianceContract.init(complianceContractAddress, signerOrProvider as Signer); const errors = []; + const decimals = await token.decimals(); + let amountWithRegardsToDecimals = amount; + + if (decimals) { + amountWithRegardsToDecimals = amount / 10 ** Number(decimals); + } + // Sender & Receiver wallets must not be frozen try { await token.areTransferPartiesFrozen(from, to); @@ -68,7 +75,7 @@ export class TransferCompliance { // Sender & Receiver must be compliant try { - await compliance.canTransferWithReasons(from, to, amount); + await compliance.canTransferWithReasons(from, to, amountWithRegardsToDecimals); } catch (error) { if (Array.isArray((error as Error).cause)) { errors.push(((error as Error).cause as string[]).join());