-
Notifications
You must be signed in to change notification settings - Fork 80
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
Don't require ICS20 module to implement Channel{Reader,Keeper} #244
Conversation
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.
Left a few things but generally looks great!
ChannelKeeper + BankKeeper<AccountId = <Self as Ics20Keeper>::AccountId> | ||
{ | ||
type AccountId; | ||
pub trait Ics20Keeper: BankKeeper { |
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.
In light of #247, can we rename this to TokenTransferKeeper
?
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.
} | ||
|
||
pub trait Ics20Reader: ChannelReader { | ||
pub trait Ics20Reader: SendPacketReader { |
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.
And this to TokenTransferReader
?
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.
* Add SendPacketReader trait with blanket impl for all types implementing ChannelReader * Have SendPacket handler depend on SendPacketReader and return SendPacketResult * Define Ics20ChannelKeeper and depend on that instead of Channel{Reader,Keeper} * Update tests * Add blanket impl for Ics20ChannelKeeper * Add changelog entry * Use where clause for trait bounds * Avoid trait object param in send_packet handler * Apply suggestion to merge Ics20ChannelKeeper into Ics20Keeper * Rename Ics20Keeper -> TokenTransferKeeper * Rename Ics20Reader -> TokenTransferReader
Closes: #182 (potential solution)
With these changes, we no longer require an ICS20 module (i.e. the type implementing
Ics20Context
) to implement the completeChannelReader
andChannelKeeper
traits. We only require them to implement theIcs20ChannelKeeper
and theSendPacketReader
traits ->ibc-rs/crates/ibc/src/applications/transfer/context.rs
Lines 25 to 26 in 42ff93f
Moreover, we also provide blanket impls for both these traits (i.e.
Ics20ChannelKeeper
andSendPacketReader
) if the type implementsChannelReader
andChannelKeeper
respectively.PR author checklist:
unclog
.docs/
).Reviewer checklist:
Files changed
in the GitHub PR explorer.