Skip to content

Commit fccbfd9

Browse files
committed
fix: change the gap to be uint144 instead of bytes18
1 parent 18f6569 commit fccbfd9

File tree

13 files changed

+35
-40
lines changed

13 files changed

+35
-40
lines changed

contracts/interfaces/ICoverProducts.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ struct Product {
1919
uint16 productType;
2020
uint16 minPrice;
2121
// leftover memory gap from the previously used address field yieldTokenAddress
22-
bytes18 __gap;
22+
uint144 __gap;
2323
// cover assets bitmap. each bit represents whether the asset with
2424
// the index of that bit is enabled as a cover asset for this product
2525
uint32 coverAssets;

test/fork/basic-functionality-tests.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const {
1717
} = require('./utils');
1818

1919
const { ProposalCategory: PROPOSAL_CATEGORIES } = require('../../lib/constants');
20-
const { daysToSeconds, emptyBytes } = require('../../lib/helpers');
20+
const { daysToSeconds } = require('../../lib/helpers');
2121
const { setNextBlockTime, mineNextBlock } = require('../utils/evm');
2222
const VariableDebtTokenAbi = require('./abi/aave/VariableDebtToken.json');
2323
const { InternalContractsIDs } = require('../utils').constants;
@@ -306,7 +306,7 @@ describe('basic functionality tests', function () {
306306
product: {
307307
productType: 0,
308308
minPrice: 0,
309-
__gap: emptyBytes(18),
309+
__gap: 0,
310310
coverAssets: 0,
311311
initialPriceRatio: 100,
312312
capacityReductionRatio: 0,
@@ -333,7 +333,7 @@ describe('basic functionality tests', function () {
333333
product: {
334334
productType: 1,
335335
minPrice: 0,
336-
__gap: emptyBytes(18),
336+
__gap: 0,
337337
coverAssets: 0,
338338
initialPriceRatio: 100,
339339
capacityReductionRatio: 0,

test/integration/StakingProducts/setProducts.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
const { expect } = require('chai');
22
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
33
const setup = require('../setup');
4-
const { emptyBytes } = require('../../utils').helpers;
54

65
const stakedProductParamTemplate = {
76
productId: 1,
@@ -15,7 +14,7 @@ const stakedProductParamTemplate = {
1514
const coverProductTemplate = {
1615
productType: 0, // uint16
1716
minPrice: 0,
18-
__gap: emptyBytes(18),
17+
__gap: 0,
1918
coverAssets: 0, // uint32
2019
initialPriceRatio: 5000, // uint16
2120
capacityReductionRatio: 0, // uint16

test/integration/setup.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const { ethers } = require('hardhat');
22

33
const { AggregatorType, Assets, ContractTypes } = require('../utils').constants;
4-
const { toBytes2, emptyBytes } = require('../utils').helpers;
4+
const { toBytes2 } = require('../utils').helpers;
55
const { proposalCategories } = require('../utils');
66
const { enrollMember, enrollABMember, getGovernanceSigner } = require('./utils/enroll');
77
const { getAccounts } = require('../utils/accounts');
@@ -413,7 +413,7 @@ async function setup() {
413413
product: {
414414
productType: 0, // Protocol Cover
415415
minPrice: 0,
416-
__gap: emptyBytes(18),
416+
__gap: 0,
417417
coverAssets: 0, // Use fallback
418418
initialPriceRatio: 100,
419419
capacityReductionRatio: 0,
@@ -615,7 +615,7 @@ async function setup() {
615615
product: {
616616
productType: 1, // Custody Cover
617617
minPrice: 0,
618-
__gap: emptyBytes(18),
618+
__gap: 0,
619619
coverAssets: 0, // Use fallback
620620
initialPriceRatio: 100,
621621
capacityReductionRatio: 0,
@@ -630,7 +630,7 @@ async function setup() {
630630
product: {
631631
productType: 2, // Yield Token Cover
632632
minPrice: 0,
633-
__gap: emptyBytes(18),
633+
__gap: 0,
634634
coverAssets: 0b01, // ETH
635635
initialPriceRatio: 500,
636636
capacityReductionRatio: 0,
@@ -645,7 +645,7 @@ async function setup() {
645645
product: {
646646
productType: 2, // Yield Token Cover
647647
minPrice: 0,
648-
__gap: emptyBytes(18),
648+
__gap: 0,
649649
coverAssets: 0b10, // DAI
650650
initialPriceRatio: 100,
651651
capacityReductionRatio: 0,
@@ -660,7 +660,7 @@ async function setup() {
660660
product: {
661661
productType: 0, // Protocol Cover
662662
minPrice: 0,
663-
__gap: emptyBytes(18),
663+
__gap: 0,
664664
coverAssets: 0, // Use fallback
665665
initialPriceRatio: 500,
666666
capacityReductionRatio: 0,
@@ -675,7 +675,7 @@ async function setup() {
675675
product: {
676676
productType: 2, // Yield Token Cover
677677
minPrice: 0,
678-
__gap: emptyBytes(18),
678+
__gap: 0,
679679
coverAssets: 0b10000, // USDC
680680
initialPriceRatio: 100,
681681
capacityReductionRatio: 0,
@@ -690,7 +690,7 @@ async function setup() {
690690
product: {
691691
productType: 0, // Protocol Cover
692692
minPrice: 0,
693-
__gap: emptyBytes(18),
693+
__gap: 0,
694694
coverAssets: 0b10000, // use usdc
695695
initialPriceRatio: 100,
696696
capacityReductionRatio: 0,
@@ -705,7 +705,7 @@ async function setup() {
705705
product: {
706706
productType: 0, // Protocol Cover
707707
minPrice: 0,
708-
__gap: emptyBytes(18),
708+
__gap: 0,
709709
coverAssets: 0, // Use fallback
710710
initialPriceRatio: 100,
711711
capacityReductionRatio: 0,

test/unit/Cover/buyCover.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
55
const { createStakingPool, assertCoverFields } = require('./helpers');
66
const setup = require('./setup');
77
const { setEtherBalance } = require('../utils').evm;
8-
const { daysToSeconds, emptyBytes } = require('../utils').helpers;
8+
const { daysToSeconds } = require('../utils').helpers;
99

1010
const { BigNumber } = ethers;
1111
const { parseEther } = ethers.utils;
@@ -82,7 +82,7 @@ describe('buyCover', function () {
8282
const productTemplate = {
8383
productType: 0,
8484
minPrice: 0,
85-
__gap: emptyBytes(18),
85+
__gap: 0,
8686
coverAssets: parseInt('111', 2), // ETH/DAI/USDC
8787
initialPriceRatio: 1000, // 10%
8888
capacityReductionRatio: capacityFactor, // 100%

test/unit/Cover/setup.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const { BigNumber } = require('ethers');
55
const { getAccounts } = require('../../utils/accounts');
66

77
const { Role } = require('../utils').constants;
8-
const { hex, emptyBytes } = require('../utils').helpers;
8+
const { hex } = require('../utils').helpers;
99

1010
const { MaxUint256 } = ethers.constants;
1111
const { getContractAddress, parseEther } = ethers.utils;
@@ -136,7 +136,7 @@ async function setup() {
136136
product: {
137137
productType: '0',
138138
minPrice: 0,
139-
__gap: emptyBytes(18),
139+
__gap: 0,
140140
coverAssets: 0, // use fallback
141141
initialPriceRatio: '1000', // 10%
142142
capacityReductionRatio: '0',
@@ -152,7 +152,7 @@ async function setup() {
152152
product: {
153153
productType: '0',
154154
minPrice: 0,
155-
__gap: emptyBytes(18),
155+
__gap: 0,
156156
coverAssets: 0, // use fallback
157157
initialPriceRatio: '1000', // 10%
158158
capacityReductionRatio: '0',
@@ -168,7 +168,7 @@ async function setup() {
168168
product: {
169169
productType: '0',
170170
minPrice: 0,
171-
__gap: emptyBytes(18),
171+
__gap: 0,
172172
coverAssets: Assets.ETH | Assets.DAI, // ETH and DAI, no USDC
173173
initialPriceRatio: '1000', // 10%
174174
capacityReductionRatio: '0',
@@ -184,7 +184,7 @@ async function setup() {
184184
product: {
185185
productType: '0',
186186
minPrice: 0,
187-
__gap: emptyBytes(18),
187+
__gap: 0,
188188
coverAssets: Assets.ETH | Assets.DAI, // ETH and DAI, no USDC
189189
initialPriceRatio: '1000', // 10%
190190
capacityReductionRatio: '0',

test/unit/CoverProducts/setProducts.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const setup = require('./setup');
55

66
const { resultAsObject } = require('../utils').results;
77
const { MaxUint256 } = ethers.constants;
8-
const { emptyBytes } = require('../utils').helpers;
98

109
describe('setProducts', function () {
1110
const priceDenominator = 10000;
@@ -16,7 +15,7 @@ describe('setProducts', function () {
1615
const productTemplate = {
1716
productType: 0,
1817
minPrice: 0,
19-
__gap: emptyBytes(18),
18+
__gap: 0,
2019
coverAssets: parseInt('111', 2), // ETH/DAI/USDC
2120
initialPriceRatio: 1000, // 10%
2221
capacityReductionRatio: capacityFactor, // 100%

test/unit/CoverProducts/setup.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ const { ethers, accounts } = require('hardhat');
22
const { BigNumber } = require('ethers');
33

44
const { Role } = require('../utils').constants;
5-
const { hex, emptyBytes } = require('../utils').helpers;
5+
const { hex } = require('../utils').helpers;
66

77
const { AddressZero, MaxUint256 } = ethers.constants;
88
const { parseEther } = ethers.utils;
@@ -110,7 +110,7 @@ async function setup() {
110110
product: {
111111
productType: 0,
112112
minPrice: 0,
113-
__gap: emptyBytes(18),
113+
__gap: 0,
114114
coverAssets: 0, // use fallback
115115
initialPriceRatio: 1000, // 10%
116116
capacityReductionRatio: 0,
@@ -126,7 +126,7 @@ async function setup() {
126126
product: {
127127
productType: 0,
128128
minPrice: 0,
129-
__gap: emptyBytes(18),
129+
__gap: 0,
130130
coverAssets: 0, // use fallback
131131
initialPriceRatio: 1000, // 10%
132132
capacityReductionRatio: 0,
@@ -142,7 +142,7 @@ async function setup() {
142142
product: {
143143
productType: 0,
144144
minPrice: 0,
145-
__gap: emptyBytes(18),
145+
__gap: 0,
146146
coverAssets: Assets.ETH | Assets.DAI, // ETH and DAI, no USDC
147147
initialPriceRatio: 1000, // 10%
148148
capacityReductionRatio: 0,
@@ -158,7 +158,7 @@ async function setup() {
158158
product: {
159159
productType: 0,
160160
minPrice: 0,
161-
__gap: emptyBytes(18),
161+
__gap: 0,
162162
coverAssets: Assets.ETH | Assets.DAI, // ETH and DAI, no USDC
163163
initialPriceRatio: 1000, // 10%
164164
capacityReductionRatio: 0,

test/unit/IndividualClaims/setup.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ const { ethers } = require('hardhat');
33
const { ASSET } = require('./helpers');
44
const { hex } = require('../../../lib/helpers');
55
const { getAccounts } = require('../../utils/accounts');
6-
const { emptyBytes } = require('../../utils').helpers;
76

87
const { parseEther } = ethers.utils;
98

@@ -81,7 +80,7 @@ async function setup() {
8180
const productTemplate = {
8281
productType: '0',
8382
minPrice: 0,
84-
__gap: emptyBytes(18),
83+
__gap: 0,
8584
coverAssets: '1',
8685
initialPriceRatio: '0',
8786
capacityReductionRatio: '0',

test/unit/StakingPool/burnStake.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ const { ethers } = require('hardhat');
33
const { loadFixture } = require('@nomicfoundation/hardhat-network-helpers');
44

55
const { getTranches, moveTimeToNextBucket, moveTimeToNextTranche, BUCKET_DURATION, setTime } = require('./helpers');
6-
const { daysToSeconds, emptyBytes } = require('../../../lib/helpers');
6+
const { daysToSeconds } = require('../../../lib/helpers');
77

88
const { AddressZero, Two, Zero } = ethers.constants;
99
const { parseEther } = ethers.utils;
@@ -37,7 +37,7 @@ const productTypeFixture = {
3737
const coverProductTemplate = {
3838
productType: 1,
3939
minPrice: 0,
40-
__gap: emptyBytes(18),
40+
__gap: 0,
4141
coverAssets: 1111,
4242
initialPriceRatio: 500,
4343
capacityReductionRatio: 0,

0 commit comments

Comments
 (0)