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: Add test to protocol contracts #95

Merged
merged 4 commits into from
Nov 7, 2023

Conversation

andresaiello
Copy link
Collaborator

@andresaiello andresaiello commented Nov 3, 2023

Summary

  • Add test to protocol contracts
  • Fix some validations already discussed with the protocol team

Test added:
ConnectorZEVM tests
ZetaConnectorZEVM
✔ Should revert if the zetaTxSender has no enough zeta
✔ Should revert if the zetaTxSender didn't allow ZetaConnector to spend Zeta token
✔ Should emit ZetaSent on success
✔ Should transfer value and gas to fungible address
✔ Should update wzeta address if is call from fungible address
✔ Should revert if try to update wzeta address from other address

ERC20Custody tests
ERC20Custody
✔ Should update the tss address
✔ Should revert if updateTSSAddress not called by tssUpdater
✔ Should update zeta fee
✔ Should revert if updateZetaFee not called by tssUpdater
✔ Should revert if updateZetaFee is higher than max
✔ Should renounce tssUpdater
✔ Should whitelist
✔ Should revert if whitelist is not called by tss
✔ Should unwhitelist
✔ Should revert if unwhitelist is not called by tss
✔ Should emit Deposit event on deposit
✔ Should emit Deposit event and do the right math if is called twice (43ms)
✔ Should revert deposit if is paused
✔ Should revert deposit if is not whitelisted
✔ Should revert deposit if has no zeta to pay fee
✔ Should emit Withdrawn event
✔ Should revert if withdraw is not called by tss
✔ Should not revert withdraw if is paused
✔ Should revert withdraw if is not whitelisted
✔ Should not allow reentrant calls to Deposit method
✔ Should not allow reentrant calls to Witdraw method

ZRC20 tests
ZRC20Contract
✔ Should return name
✔ Should return symbol
✔ Should return decimals
✔ Should return chainId
✔ Should return coinType
✔ Should return gasLimit
✔ Should return systemContractAddress
✔ Should return totalSupply
✔ Should return balanceOf
✔ Should return allowance
✔ Should deposit if is called by fungible module
✔ Should not deposit if is not called by fungible module
✔ Should transfer

40 passing (6s)

lumtis
lumtis previously approved these changes Nov 3, 2023
Copy link
Member

@lumtis lumtis left a comment

Choose a reason for hiding this comment

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

Looks good to me.
I think we could add test as part of the CI in .github

PS: didn't realize it was still in draft mode

contracts/zevm/testing/MockSystemContract.sol Outdated Show resolved Hide resolved
Copy link

@lucas-janon lucas-janon left a comment

Choose a reason for hiding this comment

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

LGTM

@andresaiello andresaiello merged commit 9bfba6f into main Nov 7, 2023
8 checks passed
@andresaiello andresaiello deleted the andy/pd-4998-feat-add-test-to-protocol-contracts branch November 7, 2023 13:55
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.

4 participants