-
Notifications
You must be signed in to change notification settings - Fork 852
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add consolidationRequestContract in jsonGenesisConfig (#7647)
* Include consolidationRequestContract in jsonGenesisConfigOptions Signed-off-by: gconnect <[email protected]> * Update changelog and ran spotlessApply Signed-off-by: gconnect <[email protected]> * Rename consolidationRequestPredeployAddress to consolidationRequestContractAddress Signed-off-by: gconnect <[email protected]> * Create request contract addresses class Signed-off-by: gconnect <[email protected]> * Update method calls Signed-off-by: gconnect <[email protected]> * Refactor RequestContractAddresses class and update method calls and test Signed-off-by: gconnect <[email protected]> --------- Signed-off-by: gconnect <[email protected]> Co-authored-by: Gabriel-Trintinalia <[email protected]>
- Loading branch information
1 parent
4f07e76
commit 04ba15a
Showing
10 changed files
with
148 additions
and
22 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
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
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
61 changes: 61 additions & 0 deletions
61
...rc/main/java/org/hyperledger/besu/ethereum/mainnet/requests/RequestContractAddresses.java
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,61 @@ | ||
/* | ||
* Copyright contributors to Hyperledger Besu. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with | ||
* the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on | ||
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations under the License. | ||
* | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
package org.hyperledger.besu.ethereum.mainnet.requests; | ||
|
||
import static org.hyperledger.besu.ethereum.mainnet.requests.ConsolidationRequestProcessor.CONSOLIDATION_REQUEST_CONTRACT_ADDRESS; | ||
import static org.hyperledger.besu.ethereum.mainnet.requests.DepositRequestProcessor.DEFAULT_DEPOSIT_CONTRACT_ADDRESS; | ||
import static org.hyperledger.besu.ethereum.mainnet.requests.WithdrawalRequestProcessor.DEFAULT_WITHDRAWAL_REQUEST_CONTRACT_ADDRESS; | ||
|
||
import org.hyperledger.besu.config.GenesisConfigOptions; | ||
import org.hyperledger.besu.datatypes.Address; | ||
|
||
public class RequestContractAddresses { | ||
private final Address withdrawalRequestContractAddress; | ||
private final Address depositContractAddress; | ||
private final Address consolidationRequestContractAddress; | ||
|
||
public RequestContractAddresses( | ||
final Address withdrawalRequestContractAddress, | ||
final Address depositContractAddress, | ||
final Address consolidationRequestContractAddress) { | ||
this.withdrawalRequestContractAddress = withdrawalRequestContractAddress; | ||
this.depositContractAddress = depositContractAddress; | ||
this.consolidationRequestContractAddress = consolidationRequestContractAddress; | ||
} | ||
|
||
public static RequestContractAddresses fromGenesis( | ||
final GenesisConfigOptions genesisConfigOptions) { | ||
return new RequestContractAddresses( | ||
genesisConfigOptions | ||
.getWithdrawalRequestContractAddress() | ||
.orElse(DEFAULT_WITHDRAWAL_REQUEST_CONTRACT_ADDRESS), | ||
genesisConfigOptions.getDepositContractAddress().orElse(DEFAULT_DEPOSIT_CONTRACT_ADDRESS), | ||
genesisConfigOptions | ||
.getConsolidationRequestContractAddress() | ||
.orElse(CONSOLIDATION_REQUEST_CONTRACT_ADDRESS)); | ||
} | ||
|
||
public Address getWithdrawalRequestContractAddress() { | ||
return withdrawalRequestContractAddress; | ||
} | ||
|
||
public Address getDepositContractAddress() { | ||
return depositContractAddress; | ||
} | ||
|
||
public Address getConsolidationRequestContractAddress() { | ||
return consolidationRequestContractAddress; | ||
} | ||
} |
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