diff --git a/contracts/BaseSynthetix.sol b/contracts/BaseSynthetix.sol index f68178221..80400445a 100644 --- a/contracts/BaseSynthetix.sol +++ b/contracts/BaseSynthetix.sol @@ -425,6 +425,8 @@ contract BaseSynthetix is IERC20, ExternStateToken, MixinResolver, ISynthetix { /// @notice Allows an account to self-liquidate anytime its c-ratio is below the target issuance ratio. function liquidateSelf() external systemActive optionalProxy returns (bool) { + require(resolver.getAddress(CONTRACT_V3_LEGACYMARKET) == address(0), "Must liquidate using V3"); + // must store liquidated account address because below functions may attempt to transfer SNX which changes messageSender address liquidatedAccount = messageSender; diff --git a/test/contracts/Liquidator.js b/test/contracts/Liquidator.js index 61d831e62..3818d3d0e 100644 --- a/test/contracts/Liquidator.js +++ b/test/contracts/Liquidator.js @@ -318,6 +318,9 @@ contract('Liquidator', accounts => { 'Must liquidate using V3' ); }); + it('when liquidateSelf() is invoked, it reverts with must liquidate using V3', async () => { + await assert.revert(synthetix.liquidateSelf({ from: alice }), 'Must liquidate using V3'); + }); }); describe('protected methods', () => { describe('only internal contracts can call', () => {