Skip to content

Commit 36df74f

Browse files
authored
Atria release v2.55 (Synthetixio#1620)
1 parent 1c3849d commit 36df74f

21 files changed

+359
-155
lines changed

contracts/WrapperFactory.sol

-3
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ contract WrapperFactory is Owned, MixinResolver, IWrapperFactory {
9393
// Transfer sUSD to the fee pool
9494
bool success = synthsUSD().transfer(feePool().FEE_ADDRESS(), amountSUSD);
9595
require(success, "Transfer did not succeed");
96-
97-
// this is supposed to be done automatically by `transfer` but for some reason that doesn't happen
98-
feePool().recordFeePaid(amountSUSD);
9996
}
10097
}
10198

contracts/test-helpers/MockSynth.sol

+42-6
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,18 @@ pragma solidity ^0.5.16;
22

33
import "../ExternStateToken.sol";
44
import "../interfaces/ISystemStatus.sol";
5+
import "../interfaces/IAddressResolver.sol";
6+
import "../interfaces/IFeePool.sol";
57

68
// Mock synth that also adheres to system status
79

810
contract MockSynth is ExternStateToken {
9-
ISystemStatus private systemStatus;
11+
IAddressResolver private addressResolver;
1012
bytes32 public currencyKey;
1113

14+
// Where fees are pooled in sUSD
15+
address public constant FEE_ADDRESS = 0xfeEFEEfeefEeFeefEEFEEfEeFeefEEFeeFEEFEeF;
16+
1217
constructor(
1318
address payable _proxy,
1419
TokenState _tokenState,
@@ -21,18 +26,49 @@ contract MockSynth is ExternStateToken {
2126
currencyKey = _currencyKey;
2227
}
2328

24-
// Allow SystemStatus to be passed in directly
25-
function setSystemStatus(ISystemStatus _status) external {
26-
systemStatus = _status;
29+
function setAddressResolver(IAddressResolver _resolver) external {
30+
addressResolver = _resolver;
2731
}
2832

2933
// Used for PurgeableSynth to test removal
3034
function setTotalSupply(uint256 _totalSupply) external {
3135
totalSupply = _totalSupply;
3236
}
3337

38+
/**
39+
* @notice _transferToFeeAddress function
40+
* non-sUSD synths are exchanged into sUSD via synthInitiatedExchange
41+
* notify feePool to record amount as fee paid to feePool */
42+
function _transferToFeeAddress(address to, uint value) internal returns (bool) {
43+
uint amountInUSD;
44+
45+
// sUSD can be transferred to FEE_ADDRESS directly
46+
if (currencyKey == "sUSD") {
47+
amountInUSD = value;
48+
_transferByProxy(messageSender, to, value);
49+
} else {
50+
// for now, do nothing
51+
}
52+
53+
// Notify feePool to record sUSD to distribute as fees
54+
IFeePool(addressResolver.getAddress("FeePool")).recordFeePaid(amountInUSD);
55+
56+
return true;
57+
}
58+
3459
function transfer(address to, uint value) external optionalProxy returns (bool) {
35-
systemStatus.requireSynthActive(currencyKey);
60+
ISystemStatus(addressResolver.getAddress("SystemStatus")).requireSynthActive(currencyKey);
61+
62+
// transfers to FEE_ADDRESS will be exchanged into sUSD and recorded as fee
63+
if (to == FEE_ADDRESS) {
64+
return _transferToFeeAddress(to, value);
65+
}
66+
67+
// transfers to 0x address will be burned
68+
if (to == address(0)) {
69+
this.burn(messageSender, value);
70+
return true;
71+
}
3672

3773
return _transferByProxy(messageSender, to, value);
3874
}
@@ -42,7 +78,7 @@ contract MockSynth is ExternStateToken {
4278
address to,
4379
uint value
4480
) external optionalProxy returns (bool) {
45-
systemStatus.requireSynthActive(currencyKey);
81+
ISystemStatus(addressResolver.getAddress("SystemStatus")).requireSynthActive(currencyKey);
4682

4783
return _transferFromByProxy(messageSender, from, to, value);
4884
}

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,7 @@ const getUsers = ({ network = 'mainnet', user, useOvm = false } = {}) => {
492492
kovan: Object.assign({}, base),
493493
'kovan-ovm': Object.assign({}, base),
494494
'mainnet-ovm': Object.assign({}, base, {
495-
owner: '0xDe910777C787903F78C89e7a0bf7F4C435cBB1Fe',
495+
owner: '0x6d4a64C57612841c2C6745dB2a4E4db34F002D20',
496496
}),
497497
rinkeby: Object.assign({}, base),
498498
ropsten: Object.assign({}, base),

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "synthetix",
3-
"version": "2.54.0",
3+
"version": "2.55.0-alpha",
44
"license": "MIT",
55
"author": "Synthetix",
66
"description": "The smart contracts which make up the Synthetix system. (synthetix.io)",

publish/deployed/kovan-ovm/deployment.json

+55-40
Large diffs are not rendered by default.

publish/deployed/kovan-ovm/versions.json

+18-2
Original file line numberDiff line numberDiff line change
@@ -922,8 +922,9 @@
922922
},
923923
"WrapperFactory": {
924924
"address": "0xcc079BCb1dAe79C4494776f096BEff683Cd571CE",
925-
"status": "current",
926-
"keccak256": "0x0a16f80beda8876e3b17af0e6841cac26e959ab3806b581aeea027c2bd9cf8d7"
925+
"status": "replaced",
926+
"keccak256": "0x0a16f80beda8876e3b17af0e6841cac26e959ab3806b581aeea027c2bd9cf8d7",
927+
"replaced_in": "v2.55.0-alpha"
927928
}
928929
}
929930
},
@@ -951,5 +952,20 @@
951952
"keccak256": "0xcbf35931a8a63393fb545169c8cb2be9b1bdee327053ee54e0482f84caa52479"
952953
}
953954
}
955+
},
956+
"v2.55.0-alpha": {
957+
"tag": "v2.55.0-alpha",
958+
"fulltag": "v2.55.0-alpha",
959+
"release": "Atria",
960+
"network": "kovan",
961+
"date": "2021-12-02T22:52:06-05:00",
962+
"commit": "c9c3471dff553de7d4baa700adc1bd71b73b58c0",
963+
"contracts": {
964+
"WrapperFactory": {
965+
"address": "0xb7469A575b7931532F09AEe2882835A0249064a0",
966+
"status": "current",
967+
"keccak256": "0x582cac91f50cfefc154d67097081d0dd0d4877333df51c3cfe19485f80ef7e74"
968+
}
969+
}
954970
}
955971
}

publish/deployed/kovan/deployment.json

+11-11
Large diffs are not rendered by default.

publish/deployed/kovan/versions.json

+18-2
Original file line numberDiff line numberDiff line change
@@ -6814,8 +6814,9 @@
68146814
},
68156815
"WrapperFactory": {
68166816
"address": "0xDE390c23De4cb2c9CC2e50c28f22A8b5f947b748",
6817-
"status": "current",
6818-
"keccak256": "0x0b16131f068641f79c66eb17f5504abe5e2df3a7c2acb097c8db05de3113c7af"
6817+
"status": "replaced",
6818+
"keccak256": "0x0b16131f068641f79c66eb17f5504abe5e2df3a7c2acb097c8db05de3113c7af",
6819+
"replaced_in": "v2.55.0-alpha"
68196820
}
68206821
}
68216822
},
@@ -6838,5 +6839,20 @@
68386839
"keccak256": "0xa1449f609b4427b695977ed157cfe46414a16d902590507338c7d5fb00c40206"
68396840
}
68406841
}
6842+
},
6843+
"v2.55.0-alpha": {
6844+
"tag": "v2.55.0-alpha",
6845+
"fulltag": "v2.55.0-alpha",
6846+
"release": "Atria",
6847+
"network": "kovan",
6848+
"date": "2021-12-02T22:52:06-05:00",
6849+
"commit": "c9c3471dff553de7d4baa700adc1bd71b73b58c0",
6850+
"contracts": {
6851+
"WrapperFactory": {
6852+
"address": "0x6B4D3e213e10d9238c1a1A87E493687cc2eb1DD0",
6853+
"status": "current",
6854+
"keccak256": "0x582cac91f50cfefc154d67097081d0dd0d4877333df51c3cfe19485f80ef7e74"
6855+
}
6856+
}
68416857
}
68426858
}

publish/deployed/mainnet-ovm/deployment.json

+68-53
Large diffs are not rendered by default.

publish/deployed/mainnet/deployment.json

+11-11
Large diffs are not rendered by default.

publish/releases.json

+7-2
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,11 @@
407407
"layer": "both",
408408
"sources": ["DebtCache", "Issuer"],
409409
"released": "both"
410+
},
411+
{
412+
"sip": 192,
413+
"layer": "both",
414+
"sources": ["WrapperFactory"]
410415
}
411416
],
412417
"releases": [
@@ -706,7 +711,7 @@
706711
"major": 2,
707712
"minor": 55
708713
},
709-
"sips": []
714+
"sips": [192]
710715
},
711716
{
712717
"name": "Atria (Optimism)",
@@ -716,7 +721,7 @@
716721
"major": 2,
717722
"minor": 55
718723
},
719-
"sips": []
724+
"sips": [192]
720725
},
721726
{
722727
"name": "Alhena",

publish/src/SafeBatchSubmitter.js

+3-5
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,10 @@ class SafeBatchSubmitter {
5555

5656
let matchedTxnIsPending = false;
5757

58-
for (const {
59-
nonce,
60-
dataDecoded: {
58+
for (const { nonce, dataDecoded } of pendingTxns.results) {
59+
const {
6160
parameters: [{ valueDecoded }],
62-
},
63-
} of pendingTxns.results) {
61+
} = dataDecoded || { parameters: [{ valueDecoded: [] }] };
6462
// figure out what the next unused nonce position is (including everything else in the queue)
6563
this.unusedNoncePosition = Math.max(this.unusedNoncePosition, nonce + 1);
6664
matchedTxnIsPending =

publish/src/commands/connect-bridge.js

+5
Original file line numberDiff line numberDiff line change
@@ -161,6 +161,11 @@ const connectLayer = async ({
161161

162162
const owner = await AddressResolver.owner();
163163
if (wallet.address.toLowerCase() !== owner.toLowerCase()) {
164+
const calldata = await AddressResolver.interface.encodeFunctionData('importAddresses', [
165+
names.map(toBytes32),
166+
addresses,
167+
]);
168+
console.log('Calldata is', calldata);
164169
await confirmAction(
165170
yellow(
166171
` ⚠️ AddressResolver is owned by ${owner} and the current signer is $${wallet.address}. Please execute the above transaction and press "y" when done.`

publish/src/commands/deploy/index.js

+1
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ const deploy = async ({
325325
limitPromise,
326326
newContractsBeingAdded,
327327
runStep,
328+
network,
328329
useOvm,
329330
});
330331

publish/src/commands/deploy/rebuild-resolver-caches.js

+89-1
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@ module.exports = async ({
1313
limitPromise,
1414
newContractsBeingAdded,
1515
runStep,
16+
network,
1617
useOvm,
1718
}) => {
1819
console.log(gray(`\n------ REBUILD RESOLVER CACHES ------\n`));
1920

20-
const { AddressResolver } = deployer.deployedContracts;
21+
const { AddressResolver, WrapperFactory } = deployer.deployedContracts;
2122

2223
const filterTargetsWith = ({ prop }) =>
2324
Object.entries(deployer.deployedContracts).filter(([, target]) => {
@@ -26,6 +27,93 @@ module.exports = async ({
2627

2728
const contractsWithRebuildableCache = filterTargetsWith({ prop: 'rebuildCache' });
2829

30+
const wrappers = [];
31+
32+
// add deployed wrappers
33+
try {
34+
const wrapperCreatedLogs = await deployer.provider.getLogs({
35+
fromBlock: 0,
36+
topics: [ethers.utils.id('WrapperCreated(address,bytes32,address)')],
37+
});
38+
39+
for (const rawLog of wrapperCreatedLogs) {
40+
const log = WrapperFactory.interface.parseLog(rawLog);
41+
wrappers.push([
42+
`Wrapper for ${yellow(
43+
ethers.utils.parseBytes32String(log.args.currencyKey)
44+
)} via token ${yellow(
45+
await new ethers.Contract(
46+
log.args.token,
47+
[
48+
{
49+
constant: true,
50+
inputs: [],
51+
name: 'name',
52+
outputs: [
53+
{
54+
type: 'string',
55+
},
56+
],
57+
payable: false,
58+
stateMutability: 'view',
59+
type: 'function',
60+
},
61+
],
62+
deployer.provider
63+
).name()
64+
)}`,
65+
new ethers.Contract(log.args.wrapperAddress, WrapperFactory.interface, deployer.provider),
66+
]); // interface doesn't matter as long as it responds to MixinResolver
67+
}
68+
} catch (err) {
69+
if (/eth_getLogs are limited to a 10,000 blocks range/.test(err.message)) {
70+
console.log(
71+
yellow.bold(
72+
'Warning: Cannot fetch logs on this network. Known limitation on OVM mainnet - cannot search back greater than 10k blocks'
73+
)
74+
);
75+
} else {
76+
throw err;
77+
}
78+
}
79+
80+
// OVM pre-regenesis
81+
if (network === 'mainnet' && useOvm) {
82+
console.log(gray('Adding 3 known OVM wrapper pre-regenesis'));
83+
wrappers.push(
84+
[
85+
'WETHWrapper',
86+
new ethers.Contract(
87+
'0x6202A3B0bE1D222971E93AaB084c6E584C29DB70',
88+
WrapperFactory.interface,
89+
deployer.provider
90+
),
91+
],
92+
[
93+
'DAIWrapper',
94+
new ethers.Contract(
95+
'0xad32aA4Bff8b61B4aE07E3BA437CF81100AF0cD7',
96+
WrapperFactory.interface,
97+
deployer.provider
98+
),
99+
],
100+
[
101+
'LUSDWrapper',
102+
new ethers.Contract(
103+
'0x8A91e92FDd86e734781c38DB52a390e1B99fba7c',
104+
WrapperFactory.interface,
105+
deployer.provider
106+
),
107+
]
108+
);
109+
}
110+
111+
console.log(gray(`found ${yellow(wrappers.length)} wrapper addresses`));
112+
113+
wrappers.forEach(([label, target]) => console.log(gray(label, 'at', yellow(target.address))));
114+
115+
contractsWithRebuildableCache.push(...wrappers);
116+
29117
// collect all resolver addresses required
30118
const contractToDepMap = {};
31119
const resolverAddressesRequired = (

publish/src/commands/nominate.js

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ const nominate = async ({
7272
} = loadConnections({
7373
network,
7474
useFork,
75+
useOvm,
7576
});
7677

7778
if (!providerUrl) {

0 commit comments

Comments
 (0)