Kwenta State Log

A living document defining the state of Kwenta

KIP-116: Smart Margin v3 Upgradability

Simple Summary

Smart Margin v3 "SMv3", serving as Kwenta's margin trading engine, directly interfaces with Synthetix v3 (1). Given that Synthetix v3 is an ever-evolving, upgradable platform that doesn't necessarily guarantee backward compatibility, our engine risks becoming outdated, potentially endangering trader funds. To address this, the KIP proposes implementing upgradability features for the SMv3 engine.


Enhance the SMv3 Engine.sol contract to make it upgradable, with the upgrades being executed and managed by the Kwenta pDAO multisig (2).


Synthetix v3 has seen rapid development in recent months, leading to significant changes in testnet deployments. These changes have, unfortunately, negated some of the progress made on SMv3. Currently, in the pre-mainnet stage, adjusting our contracts is relatively straightforward through redeployment. However, once user funds are managed by our Engine, imposing migrations on users every time Synthetix introduces an unexpected change becomes highly problematic.

A straightforward, albeit more centralized, solution is to align our upgradeability with Synthetix's. This approach gives us greater control to upgrade our system in a decentralized way through the pDAO, which will act as the gatekeeper for SMv3's upgradeability.


The SMv3 system will be made upgradeable by incorporating OpenZeppelin's UUPSUpgradeable utility (3). Upgrades will be exclusively authorized if initiated by the pDAO, and the system can permanently turn off further upgrades if deemed necessary.