# Smart Contract

## Upgradeable Swap Protocol

### What is an upgradeable contract?

One of the powerful features of the blockchain is its immutability. On the contrary, the quality of software came from upgrading and patching the code via iterative releases. The upgradeable proxy is a mechanism for upgrading smart contracts that can be controlled by a governance mechanism be it a multi-sig wallet, DAO, or even a simple address.

### Why upgradeable?

As stated above, to deliver high-quality software we would love the ability to release the features iteratively. Said features are often new DEX integration, which in return will provide a better rate swap.

So why don't we just deploy a new contract without the proxy? Because that would require our users to approve the ERC-20 every time we change the smart contract. And we believe that won't give the best trading experience which is our aim.&#x20;

The upgradeable contracts have downsides though. One of them is that a malicious actor can switch the implementation contract into something with unexpected behaviors e.g. stealing users' funds.

### How to handle the malicious action?

The address that can execute the upgrade command on the proxy is the Timelock contract. This means everyone can see the upgrade 24 hours ahead of time before the actual change takes place. The users will have a decent amount of time to act accordingly in case a questionable upgrade is about to happen.

### Deployed contracts

The explanation of each contract is as follows:

* TransparentUpgradeableProxy is a proxy contract that points to the implementation (ArkenApprove) contract. The admin of the proxy is ProxyAdmin.
* ArkenApprove is a contract that allows the transfer of funds only by ArkenDex.
* ArkenDex is the swap protocol implementation.
* ProxyAdmin is the admin of the TransparentUpgradeableProxy contract. The owner of this contract is Timelock.
* Timelock is the timelock mechanism contract. Any administration actions will be done through this contract.
* Multi-signature required 3 out of 5 owners to confirm the transaction while owners are as follows:
  * 0x77777EEf36045851c3E1832AC0815D0C894cE09f
  * 0xF29D5666174aC2A0743b6926f0e754A9f163736F
  * 0x75C58b0c23b432d0e166b7D9E6384152A49bc09C
  * 0x957964db0510BDD6E87e7516af59B74af7e68c63
  * 0x1dF0db33eFd1000FaB9662019bDb720Ff5cDfF7f

#### Arbitrum

* Proxy : 0xAaaA55c44C7B4d87662Fc8Ff1f310c96Ed57CE1F
* ArkenDexV4 : 0x0d4de4657a95a19e58f1bce423269c88c6a4b500
* ArkenDexTrader : 0x1220774a253b1a2ca7e5a2b088901e10a6e0f70e
* TimelockController: 0xbFabaa95267BA1144051bb8d39766a0A2215985C
* Multi-signature: 0x41a1552E752Baddf4aFFdd8852093DeEcdE5aC61
* ArkenSlamm: 0xB3bBb464485F159B839E1699A352cE6D542c9433

#### Ethereum

* Proxy : 0xAaaA55c44C7B4d87662Fc8Ff1f310c96Ed57CE1F
* ArkenDexV4 : 0x29e9322B85FfE72458A277549548826F6E034F8a
* ArkenDexTrader : 0x5Ff5dCfAE354031AdC5764021bF8A33Ca5E92185
* TimelockController: 0xFb5c4D167802099adb085a049B8fA39df769B07d
* Multi-signature: 0x853186004cFF42d94D0d5EDFCEfeb3eee7f2D9BE

#### BSC

* Proxy : 0xAaaA55c44C7B4d87662Fc8Ff1f310c96Ed57CE1F
* ArkenDexV4 : 0x0d4de4657a95a19e58f1bce423269c88c6a4b500
* ArkenDexTrader : 0x1220774a253b1a2ca7e5a2b088901e10a6e0f70e
* TimelockController: 0xD0f83087A8d0Cbe2f9148841b912899c26D0C0b9
* Multi-signature: 0x047c1D16BAD48f86Dc0fe8FB02be421AF1Ec3D7a
* ArkenSlamm: 0x5365fd12D65c1a0F81528165e530191617e520df

#### Avalanche&#x20;

* Proxy: 0x8f8667137Be38ca1973C908ae1A1D27CF0caCCe4
* ArkenDexV3: 0x310dcd7802875c10e128a8baf3b72d8ad6fd0a7b
* ArkenApprove: 0x5E4Bf13dCEf16a01fB14DD2F54c2660C14bFB3C1
* ProxyAdmin: 0x0db91c7dc41e6cb9c94e11d76478cf249e02afe3
* TimelockController: 0x6EDd44dD70Dca9947d7D72F664Af3579c92De279
* Multi-signature: 0x98fD41285C6F9dD2C09D3E45A24Bae4132f718ec
* ArkenSlamm: 0x8ef559eb7233beae8078df40490d4cff4ab5718f

#### Polygon \[deprecated]

* ~~Proxy: 0x11a768b4Acf0212E9B0800d1B8142763518A4fC5~~
* ~~ArkenDexV3: 0xcbd3cBC8707643cC2Ced4B40907041F9627FFB51~~
* ~~ArkenApprove: 0xda2309efc83375b6f78137f629f74a3f1584b2c5~~
* ~~ProxyAdmin: 0x56AC7D363cA6ADFd65849B6330E6E27b11D5577A~~
* ~~TimelockController: 0xB3bBb464485F159B839E1699A352cE6D542c9433~~
* ~~Multi-signature: 0x4DD1eCa21257D8bD226eE7e74f6Ac2a2659E9158~~

#### Aurora \[deprecated]

* ~~Proxy: 0x85B0b361a4453A4051C532B46209Cd7cE070f15E~~
* ~~ArkenDexV3: 0xeE6DB2CC1ed15424A00E62ccDFE23397b54AaB89~~
* ~~ArkenApprove: 0x0DB91c7dC41E6CB9C94e11D76478CF249e02Afe3~~
* ~~ProxyAdmin: 0xfFA4D6cDF9A2aeb6FcB73808785f83260b6cBd19~~
* ~~TimelockController: 0x29c79cB6324a50bd08Ac55C44a92D1A242A535F7~~
* ~~Multi-signature: 0xcDC751f0db2b2Cc493a2D3293eF141e5EdC36011~~

#### Rei \[deprecated]

* ~~Proxy: 0xC1Fe82f26E5de50e25A5662d82Ca2C09d085D35B~~
* ~~ArkenDexV3: 0x5E4Bf13dCEf16a01fB14DD2F54c2660C14bFB3C1~~
* ~~ArkenApprove: 0x0DB91c7dC41E6CB9C94e11D76478CF249e02Afe3~~
* ~~ProxyAdmin: 0x91aC657bDFF58f526E9B288c410321C7845d20a2~~
* ~~TimelockController: 0x6EDd44dD70Dca9947d7D72F664Af3579c92De279~~

#### Fantom \[deprecated]

* ~~Proxy: 0xd288A09f07C5AfBd65AEa7ba9534D5f830f9d1c6~~
* ~~ArkenDexV3: 0x9EDe19edE2baf93d25FBA4C8F58577E008b8F963~~
* ~~ArkenApprove: 0x91aC657bDFF58f526E9B288c410321C7845d20a2~~
* ~~ProxyAdmin: 0x91aC657bDFF58f526E9B288c410321C7845d20a2~~
* ~~TimelockController: 0x6EDd44dD70Dca9947d7D72F664Af3579c92De279~~
* ~~Multi-signature: 0xd231008E5BB015040cdE6f54b6da685A69eA0788~~

<br>
