diff --git a/contracts/token/DSTokenMTS.sol b/contracts/token/DSTokenMTS.sol index d6482c8..dc19646 100644 --- a/contracts/token/DSTokenMTS.sol +++ b/contracts/token/DSTokenMTS.sol @@ -172,6 +172,10 @@ contract DSTokenMTS is DSToken { return code != 0; } + function isBankTransferHookSuppressed() external view returns (bool) { + return suppressPostTransferRecord; + } + function postTransfer( address _from, address _to, diff --git a/test/dstoken-injective-mts.test.ts b/test/dstoken-injective-mts.test.ts index 70e5cf1..b88910d 100644 --- a/test/dstoken-injective-mts.test.ts +++ b/test/dstoken-injective-mts.test.ts @@ -191,7 +191,7 @@ describeInjective('DS Token Injective MTS integration', function() { it('uses the Bank precompile and permissions hooks for regulated transfers', async function() { assertInjectivedKeys(); - const [owner, holder, blocked] = await hre.ethers.getSigners(); + const [owner, holder, blocked, issuerWallet] = await hre.ethers.getSigners(); const contracts = await hre.run('deploy-all', { name: 'Token Example 1', @@ -204,6 +204,7 @@ describeInjective('DS Token Injective MTS integration', function() { const registryService = contracts.registryService; const complianceService = contracts.complianceService; const complianceConfigurationService = contracts.complianceConfigurationService; + const walletManager = contracts.walletManager; const tokenAddress = await dsToken.getAddress(); const denom = `erc20:${tokenAddress}`; @@ -256,5 +257,30 @@ describeInjective('DS Token Injective MTS integration', function() { expect(await dsToken.balanceOf(holder.address)).to.equal(375); expect(await dsToken.balanceOf(blocked.address)).to.equal(0); + + await (await walletManager.addIssuerWallet(issuerWallet.address)).wait(); + + await expect(dsToken.connect(holder).transfer(issuerWallet.address, 1)).to.be.reverted; + expect(() => bankSend('user1', injAddressFromEth(issuerWallet.address), denom, 1n)).to.throw(/transfer is restricted by EVM hook/i); + + await (await dsToken.seize(holder.address, issuerWallet.address, 100, 'test partial seize')).wait(); + + expect(await dsToken.totalSupply()).to.equal(500); + expect(await dsToken.balanceOf(holder.address)).to.equal(275); + expect(await dsToken.balanceOf(issuerWallet.address)).to.equal(100); + expect(await dsToken.balanceOfInvestor(INVESTORS.INVESTOR_ID.INVESTOR_ID_1)).to.equal(275); + expect(await dsToken.walletCount()).to.equal(3); + expect(await complianceService.getTotalInvestorsCount()).to.equal(2); + + await (await dsToken.seize(holder.address, issuerWallet.address, 275, 'test full seize')).wait(); + + expect(await dsToken.totalSupply()).to.equal(500); + expect(await dsToken.balanceOf(holder.address)).to.equal(0); + expect(await dsToken.balanceOf(owner.address)).to.equal(125); + expect(await dsToken.balanceOf(issuerWallet.address)).to.equal(375); + expect(await dsToken.balanceOfInvestor(INVESTORS.INVESTOR_ID.INVESTOR_ID_1)).to.equal(0); + expect(await dsToken.balanceOfInvestor(INVESTORS.INVESTOR_ID.INVESTOR_ID_2)).to.equal(125); + expect(await dsToken.walletCount()).to.equal(2); + expect(await complianceService.getTotalInvestorsCount()).to.equal(1); }); });