Skip to content

Commit

Permalink
Merge branch 'develop' into sccp-2053
Browse files Browse the repository at this point in the history
  • Loading branch information
leomassazza authored Oct 23, 2023
2 parents 6234791 + ee76d42 commit a5d04a9
Show file tree
Hide file tree
Showing 10 changed files with 441 additions and 234 deletions.
27 changes: 18 additions & 9 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -311,17 +311,26 @@ jobs:
steps:
- restore_cache:
keys:
- foundry-bin-${foundry_locked_commit}-12
- foundry-bin-latest-${foundry_cache_version}
- rust/install: {}
- run: |
if [ ! -d ~/.foundry ]; then
curl -O https://raw.githubusercontent.com/foundry-rs/foundry/master/foundryup/foundryup && chmod +x ./foundryup
./foundryup -C $foundry_locked_commit
fi
rm -rf *
echo 'export PATH="$PATH:$HOME/.foundry/bin"' >> $BASH_ENV
- run:
name: "Install Foundry"
working_directory: ~/
environment:
SHELL: /bin/bash
command: |-
export PATH="$PATH:$HOME/.foundry/bin"
echo 'export PATH=$PATH:$HOME/.foundry/bin' >> $BASH_ENV
if command -v anvil; then
echo "Anvil already installed"
anvil --version
else
curl -L https://foundry.paradigm.xyz | bash
foundryup
fi
rm -rf *
- save_cache:
key: foundry-bin-${foundry_locked_commit}-12
key: foundry-bin-latest-${foundry_cache_version}
paths:
- ~/.foundry/bin
- checkout
Expand Down
28 changes: 19 additions & 9 deletions .circleci/src/jobs/job-test-deploy-script.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,28 @@ steps:
# get foundry
- restore_cache:
keys:
- foundry-bin-${foundry_locked_commit}-12
- foundry-bin-latest-${foundry_cache_version}
- rust/install: {}
- run: |
if [ ! -d ~/.foundry ]; then
curl -O https://raw.githubusercontent.com/foundry-rs/foundry/master/foundryup/foundryup && chmod +x ./foundryup
./foundryup -C $foundry_locked_commit
fi
rm -rf *
echo 'export PATH="$PATH:$HOME/.foundry/bin"' >> $BASH_ENV
- run:
name: "Install Foundry"
working_directory: ~/
environment:
SHELL: /bin/bash
command: |-
export PATH="$PATH:$HOME/.foundry/bin"
echo 'export PATH=$PATH:$HOME/.foundry/bin' >> $BASH_ENV
if command -v anvil; then
echo "Anvil already installed"
anvil --version
else
curl -L https://foundry.paradigm.xyz | bash
foundryup
fi
rm -rf *
- save_cache:
key: foundry-bin-${foundry_locked_commit}-12
key: foundry-bin-latest-${foundry_cache_version}
paths:
- ~/.foundry/bin

Expand Down
92 changes: 92 additions & 0 deletions contracts/migrations/Migration_Phecda.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
pragma solidity ^0.5.16;

import "../BaseMigration.sol";
import "../AddressResolver.sol";
import "../RewardsDistribution.sol";

interface ISynthetixNamedContract {
// solhint-disable func-name-mixedcase
function CONTRACT_NAME() external view returns (bytes32);
}

// solhint-disable contract-name-camelcase
contract Migration_Phecda is BaseMigration {
// https://etherscan.io/address/0xEb3107117FEAd7de89Cd14D463D340A2E6917769;
address public constant OWNER = 0xEb3107117FEAd7de89Cd14D463D340A2E6917769;

// ----------------------------
// EXISTING SYNTHETIX CONTRACTS
// ----------------------------

// https://etherscan.io/address/0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83
AddressResolver public constant addressresolver_i = AddressResolver(0x823bE81bbF96BEc0e25CA13170F5AaCb5B79ba83);
// https://etherscan.io/address/0x94433f0DA8B5bfb473Ea8cd7ad10D9c8aef4aB7b
RewardsDistribution public constant rewardsdistribution_i =
RewardsDistribution(0x94433f0DA8B5bfb473Ea8cd7ad10D9c8aef4aB7b);

// ----------------------------------
// NEW CONTRACTS DEPLOYED TO BE ADDED
// ----------------------------------

// https://etherscan.io/address/0x94433f0DA8B5bfb473Ea8cd7ad10D9c8aef4aB7b
address public constant new_RewardsDistribution_contract = 0x94433f0DA8B5bfb473Ea8cd7ad10D9c8aef4aB7b;

constructor() public BaseMigration(OWNER) {}

function contractsRequiringOwnership() public pure returns (address[] memory contracts) {
contracts = new address[](2);
contracts[0] = address(addressresolver_i);
contracts[1] = address(rewardsdistribution_i);
}

function migrate() external onlyOwner {
// ACCEPT OWNERSHIP for all contracts that require ownership to make changes
acceptAll();

// MIGRATION
// Import all new contracts into the address resolver;
addressresolver_importAddresses_0();
// Rebuild the resolver caches in all MixinResolver contracts - batch 1;
addressresolver_rebuildCaches_1();
// Ensure the RewardsDistribution has Synthetix set as its authority for distribution;
rewardsdistribution_i.setAuthority(0xd0dA9cBeA9C3852C5d63A95F9ABCC4f6eA0F9032);
// Ensure the RewardsDistribution can find the Synthetix proxy to read and transfer;
rewardsdistribution_i.setSynthetixProxy(0xC011a73ee8576Fb46F5E1c5751cA3B9Fe0af2a6F);

// NOMINATE OWNERSHIP back to owner for aforementioned contracts
nominateAll();
}

function acceptAll() internal {
address[] memory contracts = contractsRequiringOwnership();
for (uint i = 0; i < contracts.length; i++) {
Owned(contracts[i]).acceptOwnership();
}
}

function nominateAll() internal {
address[] memory contracts = contractsRequiringOwnership();
for (uint i = 0; i < contracts.length; i++) {
returnOwnership(contracts[i]);
}
}

function addressresolver_importAddresses_0() internal {
bytes32[] memory addressresolver_importAddresses_names_0_0 = new bytes32[](1);
addressresolver_importAddresses_names_0_0[0] = bytes32("RewardsDistribution");
address[] memory addressresolver_importAddresses_destinations_0_1 = new address[](1);
addressresolver_importAddresses_destinations_0_1[0] = address(new_RewardsDistribution_contract);
addressresolver_i.importAddresses(
addressresolver_importAddresses_names_0_0,
addressresolver_importAddresses_destinations_0_1
);
}

function addressresolver_rebuildCaches_1() internal {
MixinResolver[] memory addressresolver_rebuildCaches_destinations_1_0 = new MixinResolver[](3);
addressresolver_rebuildCaches_destinations_1_0[0] = MixinResolver(0xd0dA9cBeA9C3852C5d63A95F9ABCC4f6eA0F9032);
addressresolver_rebuildCaches_destinations_1_0[1] = MixinResolver(0x83105D7CDd2fd9b8185BFF1cb56bB1595a618618);
addressresolver_rebuildCaches_destinations_1_0[2] = MixinResolver(0x39Ea01a0298C315d149a490E34B59Dbf2EC7e48F);
addressresolver_i.rebuildCaches(addressresolver_rebuildCaches_destinations_1_0);
}
}
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "synthetix",
"version": "2.94.1",
"version": "2.96.1",
"license": "MIT",
"author": "Synthetix",
"description": "The smart contracts which make up the Synthetix system. (synthetix.io)",
Expand Down
22 changes: 11 additions & 11 deletions publish/deployed/goerli/deployment.json

Large diffs are not rendered by default.

20 changes: 18 additions & 2 deletions publish/deployed/goerli/versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,9 @@
},
"RewardsDistribution": {
"address": "0x882eaF70e172b8543145811c5fE169d03740ba9a",
"status": "current",
"keccak256": "0xc79e92b862775aca623f79001f3de3f19b910d892ac16293fda30c0b5f0e6dbb"
"status": "replaced",
"keccak256": "0xc79e92b862775aca623f79001f3de3f19b910d892ac16293fda30c0b5f0e6dbb",
"replaced_in": "v2.96.0-alpha"
},
"TokenStateSynthetix": {
"address": "0xe842C91A5D2BCE122d89497f171d81067255Ad0d",
Expand Down Expand Up @@ -724,5 +725,20 @@
"keccak256": "0x0e1391394e3eead86ca2ee2e3ddb46150935bc9c1251cb49f1d9509b825b390f"
}
}
},
"v2.96.0-alpha": {
"tag": "v2.96.0-alpha",
"fulltag": "v2.96.0-alpha",
"release": "Phecda",
"network": "goerli",
"date": "2023-10-20T14:10:59-03:00",
"commit": "ef579ea6eb464c2dd9c02300332b8fb10e445ebd",
"contracts": {
"RewardsDistribution": {
"address": "0x31E1080E7eb408ff005A9108f515CfcFEa6B7584",
"status": "current",
"keccak256": "0x71b5addb5aaa4ce3ff21f68a5795b3ad75d5aa4f549fca5f0ed999a89580af0b"
}
}
}
}
Loading

0 comments on commit a5d04a9

Please sign in to comment.