-
Notifications
You must be signed in to change notification settings - Fork 69
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
feat: ERC20 currency binding #899
Conversation
New crates:
Crate versions that have been updated:
Runtime version has been increased. |
provenance, | ||
) | ||
match T::BoundErc20::contract_address(asset) { | ||
Some(_) => DepositConsequence::UnknownAsset, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why there is unknown asset here ? as it seems to be clearly known. similar questions for other methods too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CannotCreate
would be better?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i am not sure what else to choose from WithdrawConsequences
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this would be resolved by just supporting deposits i guess
@@ -758,6 +761,24 @@ impl<T: Config> Create<Balance> for Pallet<T> { | |||
} | |||
} | |||
|
|||
impl<T> BoundErc20 for Pallet<T> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i would not implement this for the pallet. I'd consider having something in our adapters that does this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i remember why is here ... as it completely relies on local functions - asset registry storages (asset type & location) and it is very tightly bound to it, i don't really see any advantage of moving it out now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also i would like to add new extrinsic to asset registry to register these erc20 by specifying contract address (basically write version of this function)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for not having this in the pallet
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vgantchev reason?
@@ -197,7 +226,13 @@ where | |||
if asset == T::GetNativeCurrencyId::get() { | |||
<T::NativeCurrency as fungible::Mutate<T::AccountId>>::mint_into(who, amount.into()).into() | |||
} else { | |||
<T::MultiCurrency as fungibles::Mutate<T::AccountId>>::mint_into(asset.into(), who, amount.into()).into() | |||
match T::BoundErc20::contract_address(asset) { | |||
Some(_) => fail!(Error::<T>::NotSupported), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not supported?
in the implementaiton of multicurrecny, you call deposit in case of deposit ( mint ).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if you check implementation of Erc20Currency that yields unsupported as well, mby cleaner would be to call deposit implementation from multicurrency here as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
more interesting would be to support deposit and withdraw by using some holding account (withdraw transfers to holding, deposit transfers from holding)
# Conflicts: # Cargo.lock # integration-tests/Cargo.toml # pallets/route-executor/Cargo.toml
Co-authored-by: Daniel Moka <mokabme@gmail.com>
# Conflicts: # Cargo.lock # integration-tests/Cargo.toml # runtime/hydradx/Cargo.toml # runtime/hydradx/src/lib.rs
# Conflicts: # Cargo.lock # integration-tests/Cargo.toml # pallets/dca/Cargo.toml # pallets/liquidity-mining/Cargo.toml # pallets/route-executor/Cargo.toml # pallets/transaction-multi-payment/Cargo.toml # pallets/xyk-liquidity-mining/Cargo.toml # pallets/xyk/Cargo.toml # runtime/hydradx/Cargo.toml # traits/Cargo.toml
…tom code implementation there
# Conflicts: # integration-tests/src/contracts.rs
…need to reinmplement the whole frontier runner and executer which comes with too much work
# Conflicts: # Cargo.lock # integration-tests/Cargo.toml # runtime/hydradx/Cargo.toml # runtime/hydradx/src/lib.rs
# Conflicts: # Cargo.lock # Cargo.toml # integration-tests/Cargo.toml # node/Cargo.toml # pallets/asset-registry/Cargo.toml # pallets/claims/Cargo.toml # pallets/currencies/Cargo.toml # pallets/evm-accounts/Cargo.toml # pallets/otc-settlements/Cargo.toml # pallets/otc/Cargo.toml # primitives/Cargo.toml # runtime/hydradx/Cargo.toml # runtime/hydradx/src/evm/evm-utility/Cargo.toml # runtime/hydradx/src/lib.rs # runtime/hydradx/src/weights/pallet_currencies.rs # runtime/hydradx/src/weights/pallet_evm_accounts.rs
# Conflicts: # Cargo.lock # runtime/hydradx/Cargo.toml # runtime/hydradx/src/lib.rs
# Conflicts: # Cargo.toml
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful
provides the ability for currencies pallet (and fungibles trait) to operate with the ERC20 contracts deployed in EVM
also allowed contracts can operate with substrate currencies through ERC20 precompiles
wip todo
future todo