balancednetwork / balanced-java-contracts

Java contracts for Balanced
Apache License 2.0
10 stars 15 forks source link

feat: sicx/balan token crosschain #455

Closed Itshyphen closed 1 month ago

Itshyphen commented 1 month ago

Description:

Commit Message

type: commit message

see the guidelines for commit messages.

Changelog Entry

version: <log entry>

Checklist:

Please review the CONTRIBUTING.md file for detailed contributing guidelines.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 78.10651% with 37 lines in your changes missing coverage. Please review.

Project coverage is 73.06%. Comparing base (5dc3c8a) to head (35ac43b). Report is 4 commits behind head on main.

Files with missing lines Patch % Lines
.../score/tokens/balancedtoken/BalancedTokenImpl.java 74.33% 22 Missing and 7 partials :warning:
...a/network/balanced/score/tokens/sicx/SicxImpl.java 77.41% 5 Missing and 2 partials :warning:
...e/tokens/balancedtoken/BalancedTokenVariables.java 96.00% 1 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #455 +/- ## ============================================ - Coverage 73.13% 73.06% -0.07% - Complexity 1592 1603 +11 ============================================ Files 115 116 +1 Lines 7637 7685 +48 Branches 930 936 +6 ============================================ + Hits 5585 5615 +30 - Misses 1652 1666 +14 - Partials 400 404 +4 ``` | [Flag](https://app.codecov.io/gh/balancednetwork/balanced-java-contracts/pull/455/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=balancednetwork) | Coverage Δ | | |---|---|---| | [java](https://app.codecov.io/gh/balancednetwork/balanced-java-contracts/pull/455/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=balancednetwork) | `73.06% <78.10%> (-0.07%)` | :arrow_down: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=balancednetwork#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

Itshyphen commented 1 month ago

Generally i think this looks correct. We should add this logic as well for now. So we can do bridging from any chain to any chain.

    @Override
    public BigInteger getHopFee(String net) {
        if (!canWithdraw(net)) {
            return BigInteger.ONE.negate();
        }
        return Context.call(BigInteger.class, getDaofund(), "claimXCallFee", net, false);
    }

    private boolean canWithdraw(String net) {
        return Context.call(Boolean.class, getDaofund(), "getXCallFeePermission", Context.getAddress(), net);
    }

yeahh, done