Giter Site home page Giter Site logo

ton-blockchain / bridge-solidity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from emelyanenkok/toncoin-bridge-evm-side

16.0 16.0 11.0 55 KB

TON-EVM Toncoin bridge - Solidity smart contracts

License: GNU General Public License v3.0

Solidity 50.34% JavaScript 49.66%

bridge-solidity's People

Contributors

emelyanenkok avatar fjolne avatar rise1507 avatar tolya-yanot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bridge-solidity's Issues

No overflow/underflow checks for numbers. Critical exploitation not found

The solidity version 0.7.4 does not automatically check numbers for overflows/underflows.

There are 3 places in the bridge solidity code that are potentially not checked for overflows:

Method increaseAllowance

_approve(msg.sender, spender, _allowances[msg.sender][spender] + addedValue);

Since this method can only be called by the account owner himself, there is no critical exploitation.

Method _transfer

_balances[recipient] += amount;

The initial emission of Toncoins is 5 billion (5^18 in nanocoins).
The emission of Toncoins from validation are equal to about a few percent per year of the total emission.
The balance is stored in 256-bit uint with max number 2^256 โ€“ 1 ~ 1e77
Thus, in a real situation, overflow cannot occur.

Method _mint

_totalSupply += amount;

_balances[account] += amount;

The mint method can be only invoked by quorum of bridge oracles.

Bridge oracles work according to the rule - if N TONCOINS are minted in the Ethereum/BSC network, then N native Toncoins must be locked in the TON network before.

Due to the reason described in the previous paragraph, overflow cannot happen in real life.

Conclusion

Despite the fact that there are no critical exploitation, in the next versions of the contract it would be good for us to use the solidity version 8+ or use the SafeMath library.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.