Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Upgrade EVM pallet to FRAMEv2 (#648)
Browse files Browse the repository at this point in the history
* darwinia-evm new style

* Update license

* Change `Module::<T>` to `Pallet<T>`

* Add lost comment

* update format

Co-authored-by: Xavier Lau <c.estlavie@icloud.com>
  • Loading branch information
bear and AurevoirXavier committed Jun 7, 2021
1 parent 989342a commit 5995741
Show file tree
Hide file tree
Showing 7 changed files with 439 additions and 393 deletions.
4 changes: 2 additions & 2 deletions bin/node/runtime/pangolin/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ impl_runtime_apis! {
}

fn account_code_at(address: H160) -> Vec<u8> {
darwinia_evm::Module::<Runtime>::account_codes(address)
darwinia_evm::Pallet::<Runtime>::account_codes(address)
}

fn author() -> H160 {
Expand All @@ -666,7 +666,7 @@ impl_runtime_apis! {
fn storage_at(address: H160, index: U256) -> H256 {
let mut tmp = [0u8; 32];
index.to_big_endian(&mut tmp);
darwinia_evm::Module::<Runtime>::account_storages(address, H256::from_slice(&tmp[..]))
darwinia_evm::Pallet::<Runtime>::account_storages(address, H256::from_slice(&tmp[..]))
}

fn call(
Expand Down
25 changes: 13 additions & 12 deletions frame/dvm-dynamic-fee/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
// SPDX-License-Identifier: Apache-2.0
// This file is part of Frontier.
// This file is part of Darwinia.
//
// Copyright (c) 2021 Parity Technologies (UK) Ltd.
// Copyright (C) 2018-2021 Darwinia Network
// SPDX-License-Identifier: GPL-3.0
//
// 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
// Darwinia is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// http://www.apache.org/licenses/LICENSE-2.0
// Darwinia is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// 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.
// You should have received a copy of the GNU General Public License
// along with Darwinia. If not, see <https://www.gnu.org/licenses/>.

#![cfg_attr(not(feature = "std"), no_std)]

Expand Down
6 changes: 3 additions & 3 deletions frame/evm/precompile/contracts/kton/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use sp_core::{H160, U256};
use sp_runtime::{traits::UniqueSaturatedInto, SaturatedConversion};
use sp_std::{borrow::ToOwned, marker::PhantomData, prelude::*, vec::Vec};

use darwinia_evm::{Account, AccountBasic, Config, Module, Runner};
use darwinia_evm::{Account, AccountBasic, Config, Pallet, Runner};
use darwinia_support::evm::POW_9;
use dp_evm::Precompile;
use dvm_ethereum::{
Expand Down Expand Up @@ -73,7 +73,7 @@ impl<T: Config + dvm_ethereum::Config> Precompile for Kton<T> {
Action::TransferAndCall(call_data) => {
// Ensure wkton is a contract
ensure!(
!crate::Module::<T>::is_contract_code_empty(&call_data.wkton_address),
!crate::Pallet::<T>::is_contract_code_empty(&call_data.wkton_address),
ExitError::Other("Wkton must be a contract!".into())
);
// Ensure context's apparent_value is zero, since the transfer value is encoded in input field
Expand Down Expand Up @@ -119,7 +119,7 @@ impl<T: Config + dvm_ethereum::Config> Precompile for Kton<T> {
Action::Withdraw(wd) => {
// Ensure wkton is a contract
ensure!(
!crate::Module::<T>::is_contract_code_empty(&context.caller),
!crate::Pallet::<T>::is_contract_code_empty(&context.caller),
ExitError::Other("The caller must be wkton contract!".into())
);
// Ensure context's apparent_value is zero
Expand Down
Loading

0 comments on commit 5995741

Please sign in to comment.