Skip to content

Commit 1068015

Browse files
authored
Merge pull request #296 from ampleforth/rebase-upgrade-recovered
Update rebase curve parameters and deviation threshold
2 parents 852c7a1 + 5614a8a commit 1068015

File tree

2 files changed

+19
-20
lines changed

2 files changed

+19
-20
lines changed

contracts/UFragmentsPolicy.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -244,11 +244,11 @@ contract UFragmentsPolicy is Ownable {
244244
Ownable.initialize(owner_);
245245

246246
// deviationThreshold = 0.05e18 = 5e16
247-
deviationThreshold = 5 * 10**(DECIMALS - 2);
247+
deviationThreshold = 25 * 10**(DECIMALS - 3);
248248

249-
rebaseFunctionGrowth = int256(3 * (10**DECIMALS));
250-
rebaseFunctionUpperPercentage = int256(10 * (10**(DECIMALS - 2))); // 0.1
251-
rebaseFunctionLowerPercentage = int256((-10) * int256(10**(DECIMALS - 2))); // -0.1
249+
rebaseFunctionGrowth = int256(45 * (10**DECIMALS));
250+
rebaseFunctionUpperPercentage = int256(5 * (10**(DECIMALS - 2))); // 0.05
251+
rebaseFunctionLowerPercentage = int256((-77) * int256(10**(DECIMALS - 3))); // -0.077
252252

253253
minRebaseTimeIntervalSec = 1 days;
254254
rebaseWindowOffsetSec = 7200; // 2AM UTC

test/unit/UFragmentsPolicy.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { ethers, upgrades, waffle } from 'hardhat'
22
import { Contract, Signer, BigNumber, BigNumberish, Event } from 'ethers'
33
import { TransactionResponse } from '@ethersproject/providers'
44
import { expect } from 'chai'
5-
import { Result } from 'ethers/lib/utils'
65
import { imul, increaseTime } from '../utils/utils'
76

87
let uFragmentsPolicy: Contract,
@@ -20,8 +19,8 @@ const INITIAL_TARGET_RATE_25P_LESS = imul(INITIAL_TARGET_RATE, '0.75', 1)
2019
const INITIAL_RATE = ethers.utils.parseUnits('1.05', 18)
2120
const INITIAL_RATE_30P_MORE = imul(INITIAL_RATE, '1.3', 1)
2221
const INITIAL_RATE_30P_LESS = imul(INITIAL_RATE, '0.7', 1)
23-
const INITIAL_RATE_2P_MORE = imul(INITIAL_RATE, '1.02', 1)
24-
const INITIAL_RATE_2P_LESS = imul(INITIAL_RATE, '0.98', 1)
22+
const INITIAL_RATE_2_5_P_MORE = imul(INITIAL_RATE, '1.025', 1)
23+
const INITIAL_RATE_2_5_P_LESS = imul(INITIAL_RATE, '0.975', 1)
2524
const INITIAL_RATE_60P_MORE = imul(INITIAL_RATE, '1.6', 1)
2625
const INITIAL_RATE_50P_LESS = imul(INITIAL_RATE, '0.5', 1)
2726
const INITIAL_RATE_2X = INITIAL_RATE.mul(2)
@@ -149,7 +148,7 @@ describe('UFragmentsPolicy:initialize', async function () {
149148

150149
it('deviationThreshold', async function () {
151150
expect(await uFragmentsPolicy.deviationThreshold()).to.eq(
152-
ethers.utils.parseUnits('5', 16),
151+
ethers.utils.parseUnits('25', 15),
153152
)
154153
})
155154
it('rebaseLag', async function () {
@@ -399,8 +398,8 @@ describe('UFragmentsPolicy:CurveParameters', async function () {
399398

400399
describe('when rebaseFunctionGrowth is more than 0', async function () {
401400
it('should setRebaseFunctionGrowth', async function () {
402-
await uFragmentsPolicy.connect(deployer).setRebaseFunctionGrowth(1000)
403-
expect(await uFragmentsPolicy.rebaseFunctionGrowth()).to.eq(1000)
401+
await uFragmentsPolicy.connect(deployer).setRebaseFunctionGrowth('42000000000000000000')
402+
expect(await uFragmentsPolicy.rebaseFunctionGrowth()).to.eq('42000000000000000000')
404403
})
405404
})
406405

@@ -702,7 +701,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
702701
await increaseTime(60)
703702

704703
await mockExternalData(
705-
INITIAL_RATE_2P_MORE.sub(2),
704+
INITIAL_RATE_2_5_P_MORE.sub(2),
706705
INITIAL_TARGET_RATE,
707706
1000,
708707
)
@@ -716,7 +715,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
716715
await increaseTime(60)
717716

718717
await mockExternalData(
719-
INITIAL_RATE_2P_LESS.add(2),
718+
INITIAL_RATE_2_5_P_LESS.add(2),
720719
INITIAL_TARGET_RATE,
721720
1000,
722721
)
@@ -991,7 +990,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
991990
prevEpoch.add(1),
992991
INITIAL_RATE_60P_MORE,
993992
INITIAL_TARGET_RATE,
994-
55,
993+
50,
995994
)
996995
})
997996

@@ -1014,7 +1013,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
10141013
.withArgs('UFragments', 'rebase', uFragmentsPolicy.address)
10151014
await expect(r)
10161015
.to.emit(mockUFragments, 'FunctionArguments')
1017-
.withArgs([prevEpoch.add(1)], [55])
1016+
.withArgs([prevEpoch.add(1)], [50])
10181017
})
10191018
})
10201019
})
@@ -1045,7 +1044,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
10451044
uFragmentsPolicy.connect(orchestrator).rebase(),
10461045
)
10471046
).requestedSupplyAdjustment,
1048-
).to.eq(-29)
1047+
).to.eq(-76)
10491048
})
10501049
})
10511050

@@ -1065,7 +1064,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
10651064
uFragmentsPolicy.connect(orchestrator).rebase(),
10661065
)
10671066
).requestedSupplyAdjustment,
1068-
).to.eq(100)
1067+
).to.eq(50)
10691068
})
10701069
})
10711070

@@ -1085,7 +1084,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
10851084
uFragmentsPolicy.connect(orchestrator).rebase(),
10861085
)
10871086
).requestedSupplyAdjustment,
1088-
).to.eq(-100)
1087+
).to.eq(-77)
10891088
})
10901089
})
10911090

@@ -1105,7 +1104,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
11051104
uFragmentsPolicy.connect(orchestrator).rebase(),
11061105
)
11071106
).requestedSupplyAdjustment,
1108-
).to.eq(-100)
1107+
).to.eq(-77)
11091108
})
11101109
})
11111110
})
@@ -1137,7 +1136,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
11371136
uFragmentsPolicy.connect(orchestrator).rebase(),
11381137
)
11391138
).requestedSupplyAdjustment,
1140-
).to.eq(-20)
1139+
).to.eq(-76)
11411140
})
11421141
})
11431142
})
@@ -1169,7 +1168,7 @@ describe('UFragmentsPolicy:Rebase', async function () {
11691168
uFragmentsPolicy.connect(orchestrator).rebase(),
11701169
)
11711170
).requestedSupplyAdjustment,
1172-
).to.eq(32)
1171+
).to.eq(49)
11731172
})
11741173
})
11751174
})

0 commit comments

Comments
 (0)