Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #146 from BeanstalkFarms/ebip6
EBIP-6: Resolve EBIP-4 and EBIP-5
- Loading branch information
Showing
5 changed files
with
232 additions
and
120 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* | ||
SPDX-License-Identifier: MIT | ||
*/ | ||
|
||
pragma solidity =0.7.6; | ||
pragma experimental ABIEncoderV2; | ||
|
||
import {AppStorage} from "../AppStorage.sol"; | ||
|
||
/** | ||
* @author Publius | ||
* @title InitEBip6 updates the mappings of Pod Orders created before BIP-29. | ||
**/ | ||
contract InitEBip6 { | ||
AppStorage internal s; | ||
|
||
function init() external { | ||
s.podOrders[0x6f668ae24be6e177f8584600dbffea6e07f260e08e21fa47792385913e786da3] = 10_491_929_346; | ||
s.podOrders[0xf47df2678d29e9d57c5e9ed5f8c990e71910918154a2ed6d5235718035d7d8b0] = 1_466_423; | ||
s.podOrders[0x186c6468ca4d3ce2575b9527fcf42cc3c86ab7cc915a550c9e84c5443691607a] = 380; | ||
} | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const fs = require('fs') | ||
const { getBeanstalk, impersonateBeanstalkOwner, mintEth } = require("../utils") | ||
|
||
async function ebip6(mock = true, account = undefined) { | ||
if (account == undefined) { | ||
account = await impersonateBeanstalkOwner() | ||
await mintEth(account.address) | ||
} | ||
|
||
beanstalk = await getBeanstalk() | ||
const tokenFacet = await (await ethers.getContractFactory("TokenFacet", account)).deploy() | ||
console.log(`Token Facet deployed to: ${tokenFacet.address}`) | ||
const ebip6 = await (await ethers.getContractFactory("InitEBip6", account)).deploy() | ||
console.log(`EBIP-6 deployed to: ${ebip6.address}`) | ||
const dc = { | ||
diamondCut: [ | ||
[ | ||
'0x0c9F436FBEf08914c1C68fe04bD573de6e327776', | ||
'0', | ||
['0xdf18a3ee', '0x845a022b', '0x82c65124'] | ||
], | ||
[ | ||
tokenFacet.address, | ||
'0', | ||
['0xd3f4ec6f'] | ||
] | ||
], | ||
initFacetAddress: ebip6.address, | ||
functionCall: ebip6.interface.encodeFunctionData('init', []) | ||
} | ||
if (mock) { | ||
const receipt = await beanstalk.connect(account).diamondCut(...Object.values(dc)) | ||
} else { | ||
const encodedDiamondCut = await beanstalk.interface.encodeFunctionData('diamondCut', Object.values(dc)) | ||
console.log(JSON.stringify(dc, null, 4)) | ||
console.log("Encoded: -------------------------------------------------------------") | ||
console.log(encodedDiamondCut) | ||
const dcName = `diamondCut-${'InitEBip6'}-${Math.floor(Date.now() / 1000)}-facets.json` | ||
await fs.writeFileSync(`./diamondCuts/${dcName}`, JSON.stringify({diamondCut: dc, encoded: encodedDiamondCut }, null, 4)); | ||
return dc | ||
} | ||
} | ||
|
||
exports.ebip6 = ebip6 |
Oops, something went wrong.