-
Notifications
You must be signed in to change notification settings - Fork 86
Fork System #1042
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
funderbrker
wants to merge
70
commits into
master
Choose a base branch
from
transmission
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fork System #1042
Changes from all commits
Commits
Show all changes
70 commits
Select commit
Hold shift + click to select a range
8ab4f74
skeleton of lineage system
funderbrker 74bf9d0
fert out logic
funderbrker 14f385f
migrate in fert
funderbrker 2fef3f8
migrate out deposits logic
funderbrker 6abcd16
fert migrate out patch
funderbrker 9b2e80a
mow on deposit migration
funderbrker 54991fa
migrate in deposits logic
funderbrker a2a22c3
compilation fixes
funderbrker 2437b86
Merge branch 'test-3' into lineage-extension
funderbrker 17bf0d1
shuffle init diamond, fix typos
funderbrker 5cceabe
migration patches. executes
funderbrker 59e7705
lineage migration test. wip.
funderbrker 50b4358
migration grown stalk fix
funderbrker de9be79
update field to handle holes via Slashing
funderbrker 9f7d9da
pod migration out
funderbrker 40a643b
migrate in plots
funderbrker fafcd7b
readme update
funderbrker 6d7a778
remove fn to add new sources
funderbrker 84fca25
partial revert of contracts/beanstalk/init/InitalizeDiamond.sol
funderbrker 14da241
rm old init file
funderbrker a1cb901
update deposits tests and supporting logic
funderbrker 52c83ec
cleap up foundry test helpers
funderbrker 67977a2
update + fix fert migration logic. add fert migration test
funderbrker 8d34f2b
finalized plot migration design. patch implementation. add plot migra…
funderbrker b120426
dust cleanup
funderbrker 3851ae9
test - migrate deposits to new
funderbrker 5cafece
parent migrate out events. bug fixes.
funderbrker 9f63558
refactor foundry tests to allow multiple beanstalks
funderbrker 41c95dd
test alternative beanstalk constants
funderbrker 441dc85
plots descendants to new instance, tests & fixes
funderbrker 00a733b
rename migrate -> transmit
funderbrker 332584a
--lineage--
funderbrker f6e6f12
fert transmit to new addr tests
funderbrker d27db02
placeholder functions for children
funderbrker c2494ae
refactor foundry tests inheritence of constants
funderbrker 7f5bf18
remove unused invariant tests
funderbrker 059a47f
transmit test constant fix
funderbrker e54daba
more fert transmission test checks
funderbrker 9c59d5e
lp transmit to child test
funderbrker 7b1c64a
source index check
funderbrker a77e3fb
push plot to back of child line if missed harvesting or deployment
funderbrker a1762f9
transmit tests for reverts and for combo transmit
funderbrker d0c15ff
fin
funderbrker 77b1919
better setting and testing of source pods
funderbrker 222f952
Merge branch 'beanstalk3-codehawks-remediations' of https://github.co…
funderbrker da4639a
Merge branch 'beanstalk3-codehawks-remediations' of https://github.co…
funderbrker 5ef5ba8
fix bad merge
funderbrker b05c9da
return a sun test
funderbrker 0e9f4ff
fix harvestableBean amt
funderbrker 80d5579
fix merge
funderbrker 3129031
track harvested in addition to processed
funderbrker 0aa27e6
harvested and slashed getters
funderbrker 9c6927e
Merge branch 'master' into transmission-merge-master-2
pizzaman1337 3d1be76
Test fixes wip
pizzaman1337 14a91d8
WIP test fixing
pizzaman1337 56cef6b
All tests passing but 1
pizzaman1337 be07d9d
All tests passing
pizzaman1337 b7562a2
prettier auto formatting changes
pizzaman1337 d025170
Update transmit in facet to accept bytes array for asset flexibility
pizzaman1337 acabd72
prettier auto formatting changes
pizzaman1337 acd0a45
Modify transmitOut to take asset bytes array
pizzaman1337 763102a
Update comment
pizzaman1337 50913a4
Merge branch 'transmission-bytes-array' of github.com:BeanstalkFarms/…
pizzaman1337 2e2a769
Test total harvested and total slashed
pizzaman1337 463740e
Don't allow transfer of germinating deposits
pizzaman1337 310496f
Update requires to asserts
pizzaman1337 0100ffb
Fix compiler warning
pizzaman1337 1d47631
Verify deposits that are still germinating after one season cannot be…
pizzaman1337 a83210c
Merge master into transmission branch (#1162)
Brean0 304fdf6
Update transmit in facet to accept bytes array for asset flexibility …
Brean0 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
40 changes: 40 additions & 0 deletions
40
protocol/contracts/beanstalk/ForkSystem/TransmitInFacet.sol
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| /** | ||
| * SPDX-License-Identifier: MIT | ||
| **/ | ||
|
|
||
| pragma solidity ^0.8.20; | ||
|
|
||
| import {AppStorage} from "contracts/beanstalk/storage/AppStorage.sol"; | ||
| import {Invariable} from "contracts/beanstalk/Invariable.sol"; | ||
| import {LibTransmitIn} from "contracts/libraries/ForkSystem/LibTransmitIn.sol"; | ||
|
|
||
| /** | ||
| * @title TransmitInFacet | ||
| * @author funderbrker | ||
| * @notice Destination instance logic for receiving transmitted assets from another version. | ||
| * @notice Destination has knowledge of valid Sources and their configurations at deployment time. | ||
| **/ | ||
| contract TransmitInFacet is Invariable { | ||
| AppStorage internal s; | ||
|
|
||
| /** | ||
| * @notice Process the inbound migration locally. | ||
| * @dev Reverts if failure to mint assets or handle migration in. | ||
| * @dev Arguments are bytes because different sources may use different encodings. | ||
| */ | ||
| function transmitIn( | ||
| address user, | ||
| bytes[][] calldata assets, | ||
| bytes calldata //data | ||
| ) external fundsSafu { | ||
| require(s.sys.supportedSourceForks[msg.sender], "Unsupported source"); | ||
| require(assets.length >= 2, "Insufficient data provided"); | ||
|
|
||
| LibTransmitIn.transmitInDeposits(user, assets[0]); | ||
| LibTransmitIn.transmitInPlots(user, assets[1]); | ||
| if (assets.length > 2) { | ||
| LibTransmitIn.transmitInFertilizer(user, assets[2]); | ||
| } | ||
| // additional assets can be processed here in the future | ||
| } | ||
| } |
54 changes: 54 additions & 0 deletions
54
protocol/contracts/beanstalk/ForkSystem/TransmitOutFacet.sol
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| /** | ||
| * SPDX-License-Identifier: MIT | ||
| **/ | ||
|
|
||
| pragma solidity ^0.8.20; | ||
|
|
||
| import {Invariable} from "contracts/beanstalk/Invariable.sol"; | ||
| import {LibTractor} from "contracts/libraries/LibTractor.sol"; | ||
| import {LibTransmitOut} from "contracts/libraries/ForkSystem/LibTransmitOut.sol"; | ||
| import {ITransmitInFacet} from "contracts/interfaces/ITransmitInFacet.sol"; | ||
|
|
||
| /** | ||
| * @title TransmitOutFacet | ||
| * @author funderbrker | ||
| * @notice Source instance logic for migrating assets to new version. | ||
| * @notice Source instance has no knowledge of possible Destinations or their configurations. | ||
| **/ | ||
| contract TransmitOutFacet is Invariable { | ||
| /** | ||
| * @notice Process the outbound migration and transfer necessary assets to destination. | ||
| * @dev Reverts if failure to burn assets or destination fails. | ||
| * @param assets Contains abi encoded deposits, plots, and fertilizer. | ||
| * @param data Currently unused but remains available for paramaters such as minimum output requirements. | ||
| */ | ||
| function transmitOut( | ||
| address destination, | ||
| bytes[] calldata assets, | ||
| bytes calldata data | ||
| ) external fundsSafu { | ||
| require(assets.length >= 3, "Missing asset data"); | ||
|
|
||
| bytes[] memory deposits = LibTransmitOut.transmitOutDeposits( | ||
| LibTractor._user(), | ||
| destination, | ||
| abi.decode(assets[0], (LibTransmitOut.SourceDeposit[])) | ||
| ); | ||
| bytes[] memory plots = LibTransmitOut.transmitOutPlots( | ||
| LibTractor._user(), | ||
| abi.decode(assets[1], (LibTransmitOut.SourcePlot[])) | ||
| ); | ||
| bytes[] memory fertilizer = LibTransmitOut.transmitOutFertilizer( | ||
| LibTractor._user(), | ||
| abi.decode(assets[2], (LibTransmitOut.SourceFertilizer[])) | ||
| ); | ||
|
|
||
| bytes[][] memory processedAssets = new bytes[][](3); | ||
| processedAssets[0] = deposits; | ||
| processedAssets[1] = plots; | ||
| processedAssets[2] = fertilizer; | ||
|
|
||
| // Reverts if Destination fails to handle transmitted assets. | ||
| ITransmitInFacet(destination).transmitIn(LibTractor._user(), processedAssets, data); | ||
| } | ||
| } |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| /* | ||
| SPDX-License-Identifier: MIT | ||
| */ | ||
|
|
||
| pragma solidity ^0.8.20; | ||
|
|
||
| import {InitializeDiamond} from "contracts/beanstalk/init/InitializeDiamond.sol"; | ||
| import {C} from "contracts/C.sol"; | ||
| import {IBean} from "contracts/interfaces/IBean.sol"; | ||
| import {LibConstant} from "test/foundry/utils/LibConstant.sol"; | ||
|
|
||
| /** | ||
| * @author Publius, Brean | ||
| * @title InitDiamond | ||
| * @notice InitDiamond initializes the Beanstalk Diamond. | ||
| * A new bean token and bean:TOKEN well are deployed. | ||
| * | ||
| **/ | ||
| contract InitDiamond is InitializeDiamond { | ||
| // initial reward for deploying beanstalk. | ||
| uint256 constant INIT_SUPPLY = 100e6; | ||
|
|
||
| function init() external { | ||
| initializeDiamond(LibConstant.BEAN, LibConstant.BEAN_ETH_WELL); | ||
|
|
||
| IBean(s.sys.tokens.bean).mint(msg.sender, INIT_SUPPLY); | ||
| } | ||
| } |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.