-
Notifications
You must be signed in to change notification settings - Fork 103
Eth-connector: merge develop branch
#109
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
02dbfd8
Document `aurora encode-address` usage.
artob 53f4cc6
Merge branch 'master' into develop
artob 996f9fc
Cache cargo artifacts between CI runs. (#92)
birchmd 2474b5d
Merge branch 'master' into develop
artob 45c1e52
Address comments from audit. (#86)
birchmd ca41305
Reduce size of `cargo cache` in CI. (#95)
birchmd bfaa2c2
Define a `Wei` newtype for balances. (#96)
birchmd 7d4990f
Fix evm-bully builds after recent refactoring. (#100)
birchmd 7b352b3
Refactor `Engine::get_state` to return a `Result`. (#99)
birchmd 2689e3b
Ensure that `Cargo.lock` in the repo is valid. (#101)
matklad 060f310
Remove unneeded nightly feature. (#102)
matklad 7ac9995
Merge branch 'develop' of https://github.com/aurora-is-near/aurora-en…
sept-en 046a560
Dispatch precompiles on the full address. (#107)
birchmd b09b530
Support state migration on upgrade. (#103)
birchmd f7c366a
Remove resolved TODOs
sept-en e450935
Merge branch 'develop' of https://github.com/aurora-is-near/aurora-en…
sept-en 7f3baab
Fix state migration test
birchmd 282c816
Conditional compilation minor improvements.
sept-en 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
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
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 |
|---|---|---|
|
|
@@ -42,7 +42,9 @@ impl FungibleToken { | |
|
|
||
| /// Balance of ETH tokens | ||
| pub fn internal_unwrap_balance_of_eth(&self, address: EthAddress) -> Balance { | ||
| engine::Engine::get_balance(&prelude::Address(address)).as_u128() | ||
| engine::Engine::get_balance(&prelude::Address(address)) | ||
| .raw() | ||
| .as_u128() | ||
| } | ||
|
|
||
| /// Internal deposit NEAR - NEP-141 | ||
|
|
@@ -63,7 +65,10 @@ impl FungibleToken { | |
| pub fn internal_deposit_eth(&mut self, address: EthAddress, amount: Balance) { | ||
| let balance = self.internal_unwrap_balance_of_eth(address); | ||
| if let Some(new_balance) = balance.checked_add(amount) { | ||
| engine::Engine::set_balance(&prelude::Address(address), &U256::from(new_balance)); | ||
| engine::Engine::set_balance( | ||
| &prelude::Address(address), | ||
| &Wei::new(U256::from(new_balance)), | ||
| ); | ||
| self.total_supply_eth = self | ||
| .total_supply_eth | ||
| .checked_add(amount) | ||
|
|
@@ -114,7 +119,10 @@ impl FungibleToken { | |
| pub fn internal_withdraw_eth(&mut self, address: EthAddress, amount: Balance) { | ||
| let balance = self.internal_unwrap_balance_of_eth(address); | ||
| if let Some(new_balance) = balance.checked_sub(amount) { | ||
| engine::Engine::set_balance(&prelude::Address(address), &U256::from(new_balance)); | ||
| engine::Engine::set_balance( | ||
| &prelude::Address(address), | ||
| &Wei::new(U256::from(new_balance)), | ||
| ); | ||
| self.total_supply_eth = self | ||
| .total_supply_eth | ||
| .checked_sub(amount) | ||
|
|
@@ -426,7 +434,9 @@ impl FungibleToken { | |
| pub fn accounts_insert(&self, account_id: &str, amount: Balance) { | ||
| if !self.accounts_contains_key(account_id) { | ||
| let key = Self::get_statistic_key(); | ||
| //TODO: verify `read_u64` unwrapping | ||
|
artob marked this conversation as resolved.
Outdated
|
||
| let accounts_counter = sdk::read_u64(&key) | ||
| .unwrap_or(Ok(0)) | ||
| .unwrap_or(0) | ||
| .checked_add(1) | ||
| .expect("ERR_ACCOUNTS_COUNTER_OVERFLOW"); | ||
|
|
@@ -438,7 +448,10 @@ impl FungibleToken { | |
| /// Get accounts counter for statistics | ||
| /// It represents total unique accounts. | ||
| pub fn get_accounts_counter(&self) -> u64 { | ||
| sdk::read_u64(&Self::get_statistic_key()).unwrap_or(0) | ||
| //TODO: verify `read_u64` unwrapping | ||
| sdk::read_u64(&Self::get_statistic_key()) | ||
| .unwrap_or(Ok(0)) | ||
| .unwrap_or(0) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It looks really strange. |
||
| } | ||
|
|
||
| fn accounts_contains_key(&self, account_id: &str) -> bool { | ||
|
|
||
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.