Skip to content

Commit

Permalink
Fix SOP (#575)
Browse files Browse the repository at this point in the history
  • Loading branch information
publiuss authored Aug 3, 2023
2 parents a1d84fe + e359779 commit 9d2820c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 11 deletions.
4 changes: 1 addition & 3 deletions protocol/contracts/beanstalk/sun/SeasonFacet/Weather.sol
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,7 @@ contract Weather is Sun {
s.season.rainStart = s.season.current;
s.r.pods = s.f.pods;
s.r.roots = s.s.roots;
} else if (
s.season.current >= s.season.rainStart.add(s.season.withdrawSeasons - 1)
) {
} else {
if (s.r.roots > 0) {
sop();
}
Expand Down
2 changes: 1 addition & 1 deletion protocol/test/Season.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ describe('Season', function () {
await beanstalk.connect(user).sunrise();
await setToSecondsAfterHour(0)
await beanstalk.connect(owner).sunrise();
expect(await bean.balanceOf(owner.address)).to.be.within('10400000', '10500000')
expect(await bean.balanceOf(owner.address)).to.be.within('10500000', '10600000')
})
})
})
14 changes: 7 additions & 7 deletions protocol/test/Sop.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ describe('Sop', function () {
await this.beanMetapool.connect(user).add_liquidity([to6('0'), to18('200')], to18('50'))
await this.season.rainSunrise();
await this.silo.mow(user2Address, this.bean.address);
await this.season.rainSunrises(24);
await this.season.rainSunrise();
})

it('sops p > 1', async function () {
Expand Down Expand Up @@ -169,10 +169,10 @@ describe('Sop', function () {
await this.beanMetapool.connect(user).add_liquidity([to6('0'), to18('200')], to18('50'))
await this.season.rainSunrise();
await this.silo.mow(user2Address, this.bean.address);
await this.season.rainSunrises(24);
await this.season.rainSunrise();
await this.season.droughtSunrise();
await this.beanMetapool.connect(user).add_liquidity([to6('0'), to18('200')], to18('50'))
await this.season.rainSunrises(25);
await this.season.rainSunrises(2);
})

it('sops p > 1', async function () {
Expand All @@ -192,8 +192,8 @@ describe('Sop', function () {
it('tracks user plenty after update', async function () {
await this.silo.mow(userAddress, this.beanMetapool.address);
const userSop = await this.silo.balanceOfSop(userAddress);
expect(userSop.lastRain).to.be.equal(29)
expect(userSop.lastSop).to.be.equal(29)
expect(userSop.lastRain).to.be.equal(6)
expect(userSop.lastSop).to.be.equal(6)
expect(userSop.roots).to.be.equal('10000000000000000000000000')
expect(userSop.plenty).to.be.equal('100393700583386272030')
expect(userSop.plentyPerRoot).to.be.equal('10039370058338627203')
Expand All @@ -207,8 +207,8 @@ describe('Sop', function () {
await this.silo.mow(user2Address, this.beanMetapool.address);
await this.silo.mow(user2Address, this.bean.address);
const userSop = await this.silo.balanceOfSop(user2Address);
expect(userSop.lastRain).to.be.equal(29)
expect(userSop.lastSop).to.be.equal(29)
expect(userSop.lastRain).to.be.equal(6)
expect(userSop.lastSop).to.be.equal(6)
expect(userSop.roots).to.be.equal('10002000000000000000000000')
expect(userSop.plenty).to.be.equal('100403737702033678721')
expect(userSop.plentyPerRoot).to.be.equal('10039370058338627203')
Expand Down

0 comments on commit 9d2820c

Please sign in to comment.