Skip to content

Commit

Permalink
fix feature issue
Browse files Browse the repository at this point in the history
  • Loading branch information
forcodedancing committed May 29, 2024
1 parent bcd409b commit 90a0d6c
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 43 deletions.
2 changes: 1 addition & 1 deletion crates/optimism/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ optimism = [
"reth-provider/optimism",
"reth-interfaces/optimism",
"revm-primitives/optimism",
]
]
85 changes: 43 additions & 42 deletions crates/optimism/evm/src/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -357,48 +357,49 @@ where
block.withdrawals.as_ref().map(Withdrawals::as_ref),
);

#[cfg(all(feature = "optimism", feature = "opbnb"))]
if self.chain_spec.fork(Hardfork::PreContractForkBlock).transitions_at_block(block.number) {
// WBNBContract WBNB preDeploy contract address
let w_bnb_contract_address =
Address::from_str("0x4200000000000000000000000000000000000006").unwrap();
let mut w_bnb_storage = PlainStorage::new();
// insert storage for wBNB contract
// nameSlot { Name: "Wrapped BNB" }
w_bnb_storage.insert(
U256::from_str(
"0x0000000000000000000000000000000000000000000000000000000000000000",
)
.unwrap(),
U256::from_str(
"0x5772617070656420424e42000000000000000000000000000000000000000016",
)
.unwrap(),
);
// symbolSlot { Symbol: "wBNB" }
w_bnb_storage.insert(
U256::from_str(
"0x0000000000000000000000000000000000000000000000000000000000000001",
)
.unwrap(),
U256::from_str(
"0x57424e4200000000000000000000000000000000000000000000000000000008",
)
.unwrap(),
);
// insert wBNB contract with storage
self.db_mut().insert_account_with_storage(
w_bnb_contract_address,
AccountInfo::default(),
w_bnb_storage,
);
// GovernanceToken contract address
let governance_token_contract_address =
Address::from_str("0x4200000000000000000000000000000000000042").unwrap();
// destruct the governance token contract
self.evm
.selfdestruct(governance_token_contract_address, governance_token_contract_address);
}
// TODO: rebase with the fix
// #[cfg(all(feature = "optimism", feature = "opbnb"))]
// if self.chain_spec.fork(Hardfork::PreContractForkBlock).transitions_at_block(block.
// number) { // WBNBContract WBNB preDeploy contract address
// let w_bnb_contract_address =
// Address::from_str("0x4200000000000000000000000000000000000006").unwrap();
// let mut w_bnb_storage = PlainStorage::new();
// // insert storage for wBNB contract
// // nameSlot { Name: "Wrapped BNB" }
// w_bnb_storage.insert(
// U256::from_str(
// "0x0000000000000000000000000000000000000000000000000000000000000000",
// )
// .unwrap(),
// U256::from_str(
// "0x5772617070656420424e42000000000000000000000000000000000000000016",
// )
// .unwrap(),
// );
// // symbolSlot { Symbol: "wBNB" }
// w_bnb_storage.insert(
// U256::from_str(
// "0x0000000000000000000000000000000000000000000000000000000000000001",
// )
// .unwrap(),
// U256::from_str(
// "0x57424e4200000000000000000000000000000000000000000000000000000008",
// )
// .unwrap(),
// );
// // insert wBNB contract with storage
// self.db_mut().insert_account_with_storage(
// w_bnb_contract_address,
// AccountInfo::default(),
// w_bnb_storage,
// );
// // GovernanceToken contract address
// let governance_token_contract_address =
// Address::from_str("0x4200000000000000000000000000000000000042").unwrap();
// // destruct the governance token contract
// self.evm
// .selfdestruct(governance_token_contract_address,
// governance_token_contract_address); }

// increment balances
self.state
Expand Down

0 comments on commit 90a0d6c

Please sign in to comment.