Skip to content
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: improve logging #16

Merged
merged 8 commits into from
Aug 20, 2024
Merged

feat: improve logging #16

merged 8 commits into from
Aug 20, 2024

Conversation

fadeev
Copy link
Member

@fadeev fadeev commented Aug 20, 2024

Nicer output to make it easier for developer to distinguish actions happening on EVM vs ZetaChain.

  • Protocol contracts addresses output during initialization
Screenshot 2024-08-20 at 11 16 07
  • onCrossChainCall with params
  • Printing events. Events are not decoded for now (we need ABI for this), but it's better than nothing. We can also modify the interact task to watch for events after broadcasting a tx and decoding them.
Screenshot 2024-08-20 at 11 14 00
  • set ZRC-20 withdraw fee using the system contract

Using Ansis not Chalk for colors, because Chalk doesn't support TS.

@fadeev fadeev marked this pull request as ready for review August 20, 2024 13:34
@fadeev fadeev requested review from lumtis, skosito and fbac as code owners August 20, 2024 13:34
@fadeev
Copy link
Member Author

fadeev commented Aug 20, 2024

Didn't finish, because I'm blocked on not being able to make calls from ZetaChain: #17

@fadeev fadeev marked this pull request as draft August 20, 2024 16:07
@fadeev fadeev marked this pull request as ready for review August 20, 2024 18:03
@fadeev
Copy link
Member Author

fadeev commented Aug 20, 2024

Ready for review, @skosito


const FUNGIBLE_MODULE_ADDRESS = "0x735b14BB79463307AAcBED86DAf3322B1e6226aB";

const log = (chain: "EVM" | "ZetaChain", ...messages: any[]) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, but messages can be string[] most likely?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

);
});
} catch (e: any) {
log("ZetaChain", ansis.red`Error executing onCrossChainCall: ${e}`);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit, but logErr wrapper around this might be more convenient, up to you

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fadeev fadeev merged commit 2a68176 into main Aug 20, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants