Repository: skalenetwork/IMA (language: python)

Issue:
Update deployed version



Discussion / hints:

Fix patch:
diff --git a/proxy/DEPLOYED b/proxy/DEPLOYED
index a939f53a1..10e7a5846 100644
--- a/proxy/DEPLOYED
+++ b/proxy/DEPLOYED
@@ -1,1 +1,1 @@
-1.3.2-stable.1
\ No newline at end of file
+1.3.4-stable.0
\ No newline at end of file
diff --git a/proxy/contracts/mainnet/DepositBoxes/DepositBoxERC20.sol b/proxy/contracts/mainnet/DepositBoxes/DepositBoxERC20.sol
index ae2c1fa44..4f25abadf 100644
--- a/proxy/contracts/mainnet/DepositBoxes/DepositBoxERC20.sol
+++ b/proxy/contracts/mainnet/DepositBoxes/DepositBoxERC20.sol
@@ -115,6 +115,34 @@ contract DepositBoxERC20 is DepositBox, IDepositBoxERC20 {
      */
     event TransferSkipped(uint256 id);
 
+    /**
+     * @dev Emitted when big transfer threshold is changed
+     */
+    event BigTransferThresholdIsChanged(
+        bytes32 indexed schainHash,
+        address indexed token,
+        uint256 oldValue,
+        uint256 newValue
+    );
+
+    /**
+     * @dev Emitted when big transfer delay is changed
+     */
+    event BigTransferDelayIsChanged(
+        bytes32 indexed schainHash,
+        uint256 oldValue,
+        uint256 newValue
+    );
+
+    /**
+     * @dev Emitted when arbitrage duration is changed
+     */
+    event ArbitrageDurationIsChanged(
+        bytes32 indexed schainHash,
+        uint256 oldValue,
+        uint256 newValue
+    );
+
     /**
      * @dev Allows `msg.sender` to send ERC20 token from mainnet to schain
      *
@@ -260,6 +288,12 @@ contract DepositBoxERC20 is DepositBox, IDepositBoxERC20 {
         onlySchainOwner(schainName)
     {
         bytes32 schainHash = _schainHash(schainName);
+        emit BigTransferThresholdIsChanged(
+            schainHash,
+            token,
+            _delayConfig[schainHash].bigTransferThreshold[token],
+            value
+        );
         _delayConfig[schainHash].bigTransferThreshold[token] = value;
     }
 
@@ -284,6 +318,7 @@ contract DepositBoxERC20 is DepositBox, IDepositBoxERC20 {
         bytes32 schainHash = _schainHash(schainName);
         // need to restrict big delays to avoid overflow
         require(delayInSeconds < 1e8, "Delay is too big"); // no more then ~ 3 years
+        emit BigTransferDelayIsChanged(schainHash, _delayConfig[schainHash].transferDelay, delayInSeconds);
         _delayConfig[schainHash].transferDelay = delayInSeconds;
     }
 
@@ -306,6 +341,7 @@ contract DepositBoxERC20 is DepositBox, IDepositBoxERC20 {
         bytes32 schainHash = _schainHash(schainName);
         // need to restrict big delays to avoid overflow
         require(delayInSeconds < 1e8, "Delay is too big"); // no more then ~ 3 years
+        emit ArbitrageDurationIsChanged(schainHash, _delayConfig[schainHash].arbitrageDuration, delayInSeconds);
         _delayConfig[schainHash].arbitrageDuration = delayInSeconds;
     }
 
diff --git a/proxy/migrations/tools/gnosis-safe.ts b/proxy/migrations/tools/gnosis-safe.ts
index b4938e319..1e5013f79 100644
--- a/proxy/migrations/tools/gnosis-safe.ts
+++ b/proxy/migrations/tools/gnosis-safe.ts
@@ -9,6 +9,7 @@ type Ethers = typeof ethers & HardhatEthersHelpers;
 enum Network {
     MAINNET = 1,
     RINKEBY = 4,
+    GOERLI = 5,
     GANACHE = 1337,
     HARDHAT = 31337,
 }
@@ -19,6 +20,7 @@ const ADDRESSES = {
     multiSend: {
         [Network.MAINNET]: "0x8D29bE29923b68abfDD21e541b9374737B49cdAD",
         [Network.RINKEBY]: "0x8D29bE29923b68abfDD21e541b9374737B49cdAD",
+        [Network.GOERLI]: "0x8D29bE29923b68abfDD21e541b9374737B49cdAD",
     },
 }
 
@@ -26,10 +28,12 @@ const URLS = {
     safe_transaction: {
         [Network.MAINNET]: "https://safe-transaction.mainnet.gnosis.io",
         [Network.RINKEBY]: "https://safe-transaction.rinkeby.gnosis.io",
+        [Network.GOERLI]: "https://safe-transaction.goerli.gnosis.io",
     },
     safe_relay: {
         [Network.MAINNET]: "https://safe-relay.mainnet.gnosis.io",
         [Network.RINKEBY]: "https://safe-relay.rinkeby.gnosis.io",
+        [Network.GOERLI]: "https://safe-relay.goerli.gnosis.io",
     }
 }
 
@@ -40,6 +44,8 @@ function getMultiSendAddress(chainId: number, isSafeMock: boolean = false) {
         return ADDRESSES.multiSend[chainId];
     } else if (chainId === Network.RINKEBY) {
         return ADDRESSES.multiSend[chainId];
+    } else if (chainId === Network.GOERLI) {
+        return ADDRESSES.multiSend[chainId];
     } else if ([Network.GANACHE, Network.HARDHAT].includes(chainId)) {
         return ethers.constants.AddressZero;
     } else {
@@ -50,7 +56,9 @@ function getMultiSendAddress(chainId: number, isSafeMock: boolean = false) {
 export function getSafeTransactionUrl(chainId: number) {
     if (chainId === Network.MAINNET) {
         return URLS.safe_transaction[chainId];
-    } else if (chainId === 4) {
+    } else if (chainId === Network.RINKEBY) {
+        return URLS.safe_transaction[chainId];
+    } else if (chainId === Network.GOERLI) {
         return URLS.safe_transaction[chainId];
     } else {
         throw Error("Can't get safe-transaction url at network with chainId = " + chainId);
@@ -58,10 +66,8 @@ export function getSafeTransactionUrl(chainId: number) {
 }
 
 export function getSafeRelayUrl(chainId: number) {
-    if (chainId === 1) {
-        return URLS.safe_relay[chainId];
-    } else if (chainId === 4) {
-        return URLS.safe_relay[chainId];
+    if (Object.keys(URLS.safe_relay).includes(chainId.toString())) {
+        return URLS.safe_relay[chainId as keyof typeof URLS.safe_relay];
     } else {
         throw Error("Can't get safe-relay url at network with chainId = " + chainId);
     }
diff --git a/proxy/migrations/tools/verification.ts b/proxy/migrations/tools/verification.ts
index bc37440ff..6373c6741 100644
--- a/proxy/migrations/tools/verification.ts
+++ b/proxy/migrations/tools/verification.ts
@@ -12,7 +12,7 @@ export async function verify(contractName: string, contractAddress: string, cons
                 });
                 break;
             } catch (e: any) {
-                if (e.toString().includes("Already Verified")) {
+                if (e.toString().includes("Contract source code already verified")) {
                     console.log(chalk.grey(`${contractName} is already verified`));
                     return;
                 }
diff --git a/proxy/migrations/upgradeMainnet.ts b/proxy/migrations/upgradeMainnet.ts
index 1cdb09380..3ca1967c1 100644
--- a/proxy/migrations/upgradeMainnet.ts
+++ b/proxy/migrations/upgradeMainnet.ts
@@ -9,75 +9,10 @@ import hre from "hardhat";
 
 async function main() {
     await upgrade(
-        "1.3.2",
+        "1.3.4",
         contracts,
         async (safeTransactions, abi) => undefined,
-        async (safeTransactions, abi) => {
-            const proxyAdmin = await getManifestAdmin(hre);
-            const owner = await proxyAdmin.owner();
-            const communityPoolName = "CommunityPool";
-            const communityPoolFactory = await ethers.getContractFactory(communityPoolName);
-            const communityPoolAddress = abi[getContractKeyInAbiFile(communityPoolName) + "_address"];
-            let communityPool;
-            if (communityPoolAddress) {
-                communityPool = communityPoolFactory.attach(communityPoolAddress) as CommunityPool;
-                const constantSetterRole = await communityPool.CONSTANT_SETTER_ROLE();
-                const isHasRole = await communityPool.hasRole(constantSetterRole, owner);
-                if (!isHasRole) {
-                    console.log(chalk.yellow("Prepare transaction to grantRole CONSTANT_SETTER_ROLE to " + owner));
-                    safeTransactions.push(encodeTransaction(
-                        0,
-                        communityPoolAddress,
-                        0,
-                        communityPool.interface.encodeFunctionData("grantRole", [constantSetterRole, owner])
-                    ));
-                }
-                console.log(chalk.yellow("Prepare transaction to set multiplier to 3/2"));
-                safeTransactions.push(encodeTransaction(
-                    0,
-                    communityPoolAddress,
-                    0,
-                    communityPool.interface.encodeFunctionData("setMultiplier", [3, 2])
-                ));
-                console.log(chalk.yellow("Prepare transaction to set header message gas cost to 73800"));
-            } else {
-                console.log(chalk.red("CommunityPool was not found!"));
-                console.log(chalk.red("Check your abi!!!"));
-                process.exit(1);
-            }
-
-            const messageProxyForMainnet = (await ethers.getContractFactory("MessageProxyForMainnet"))
-            .attach(abi[getContractKeyInAbiFile("MessageProxyForMainnet") + "_address"]) as MessageProxyForMainnet;
-
-            if (! await messageProxyForMainnet.hasRole(await messageProxyForMainnet.CONSTANT_SETTER_ROLE(), owner)) {
-                console.log(chalk.yellow("Prepare transaction to grantRole CONSTANT_SETTER_ROLE to " + owner));
-                safeTransactions.push(encodeTransaction(
-                    0,
-                    messageProxyForMainnet.address,
-                    0,
-                    messageProxyForMainnet.interface.encodeFunctionData(
-                        "grantRole",
-                        [ await messageProxyForMainnet.CONSTANT_SETTER_ROLE(), owner ]
-                    )
-                ));
-            }
-
-            const newHeaderMessageGasCost = 92251;
-
-            console.log(chalk.yellow(
-                "Prepare transaction to set header message gas cost to",
-                newHeaderMessageGasCost.toString()
-            ));
-            safeTransactions.push(encodeTransaction(
-                0,
-                messageProxyForMainnet.address,
-                0,
-                messageProxyForMainnet.interface.encodeFunctionData(
-                    "setNewHeaderMessageGasCost",
-                    [ newHeaderMessageGasCost ]
-                )
-            ));
-        },
+        async (safeTransactions, abi) => undefined,
         "proxyMainnet"
     );
 }
diff --git a/proxy/migrations/upgradeSchain.ts b/proxy/migrations/upgradeSchain.ts
index f787263dd..b1cbbd7d8 100644
--- a/proxy/migrations/upgradeSchain.ts
+++ b/proxy/migrations/upgradeSchain.ts
@@ -14,7 +14,7 @@ async function main() {
     const pathToManifest: string = stringValue(process.env.MANIFEST);
     await manifestSetup( pathToManifest );
     await upgrade(
-        "1.3.2",
+        "1.3.4",
         contracts,
         async (safeTransactions, abi) => {
             // deploying of new contracts


Test patch:
diff --git a/proxy/test/DepositBoxERC20.ts b/proxy/test/DepositBoxERC20.ts
index d8242f2c9..6b37c51ad 100644
--- a/proxy/test/DepositBoxERC20.ts
+++ b/proxy/test/DepositBoxERC20.ts
@@ -471,10 +471,19 @@ describe("DepositBoxERC20", () => {
                 await token2.connect(user).approve(depositBoxERC20.address, depositedAmount);
                 await depositBoxERC20.connect(user).depositERC20(schainName, token2.address, depositedAmount);
 
-                await depositBoxERC20.connect(schainOwner).setBigTransferValue(schainName, token.address, bigAmount);
+                await expect(
+                    depositBoxERC20.connect(schainOwner).setBigTransferValue(schainName, token.address, bigAmount)
+                ).to.emit(depositBoxERC20, "BigTransferThresholdIsChanged")
+                    .withArgs(schainHash, token.address, 0, bigAmount);
                 await depositBoxERC20.connect(schainOwner).setBigTransferValue(schainName, token2.address, bigAmount);
-                await depositBoxERC20.connect(schainOwner).setBigTransferDelay(schainName, timeDelay);
-                await depositBoxERC20.connect(schainOwner).setArbitrageDuration(schainName, arbitrageDuration);
+                await expect(
+                    depositBoxERC20.connect(schainOwner).setBigTransferDelay(schainName, timeDelay)
+                ).to.emit(depositBoxERC20, "BigTransferDelayIsChanged")
+                    .withArgs(schainHash, 0, timeDelay);
+                await expect(
+                    depositBoxERC20.connect(schainOwner).setArbitrageDuration(schainName, arbitrageDuration)
+                ).to.emit(depositBoxERC20, "ArbitrageDurationIsChanged")
+                    .withArgs(schainHash, 0, arbitrageDuration);
 
                 await depositBoxERC20.grantRole(await depositBoxERC20.ARBITER_ROLE(), deployer.address);
             });