Git Product home page Git Product logo

contractv2's People

Contributors

attens1423 avatar autarkxu avatar dodoricky avatar dominator008 avatar owen05 avatar radar-bear avatar skyewwww avatar socratebox avatar traceurl avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

contractv2's Issues

Use Local Memory Type Variable Instead of Global Storage Type Variable in Event to Save Gas

Hi, we recently have conducted a systematic study about Solidity event usage, evolution, and impact, and we are attempting to build a tool to improve the practice of Solidity event use based on our findings. We have tried our prototype tool on some of the most popular GitHub Solidity repositories, and for your repository, we find a potential optimization of gas consumption arisen from event use.

The point is that when we use emit operation to store the value of a certain variable, local memory type variable would be preferable to global storage type (state) variable if they hold the same value. The reason is that an extra SLOAD operation would be needed to access the variable if it is storage type, and the SLOAD operation costs 800 gas.

For your repository, we find that the following event use can be improved:

  • vDODOToken.sol
    function name:updateDODOFeeBurnRatio
    event name:  UpdateDODOFeeBurnRatio
    variable:    DODO_FEE_BURN_RATIO->dodoFeeBurnRatio
    function updateDODOFeeBurnRatio(uint256 dodoFeeBurnRatio) public onlyOwner {
        _DODO_FEE_BURN_RATIO_ = dodoFeeBurnRatio;
        emit UpdateDODOFeeBurnRatio(_DODO_FEE_BURN_RATIO_);
    }
  • DODOIncentive.sol
    function name:changePerReward
    event name:  SetPerReward
    variable:    dodoPerBlock->_dodoPerBlock
    function changePerReward(uint256 _dodoPerBlock) public onlyOwner {
        _updateTotalReward();
        dodoPerBlock = _dodoPerBlock;
        emit SetPerReward(dodoPerBlock);
    }

  function name:changeDefaultRate
  event name:  SetDefaultRate
  variable:    defaultRate->_defaultRate

    function changeDefaultRate(uint256 _defaultRate) public onlyOwner {
        defaultRate = _defaultRate;
        emit SetDefaultRate(defaultRate);
    }

  function name:changeDODOProxy
  event name:  SetNewProxy
  variable:    DODO_PROXY->_dodoProxy

    function changeDODOProxy(address _dodoProxy) public onlyOwner {
        _DODO_PROXY_ = _dodoProxy;
        emit SetNewProxy(_DODO_PROXY_);
    }
  • RewardVault.sol
    function name:syncValue
    event name:  DepositReward
    variable:    REWARD_RESERVE->rewardBalance
    function syncValue() external {
        uint256 rewardBalance = IERC20(_REWARD_TOKEN_).balanceOf(address(this));
        uint256 rewardInput = rewardBalance.sub(_REWARD_RESERVE_);

        _TOTAL_REWARD_ = _TOTAL_REWARD_.add(rewardInput);
        _REWARD_RESERVE_ = rewardBalance;

        emit DepositReward(_TOTAL_REWARD_, rewardInput, _REWARD_RESERVE_);
    }

Do you find our results useful? Your reply and invaluable suggestions would be greatly appreciated, and are vital for improving our tool. Thanks a lot for your time!

Calc amount in/out

Hi,
How can I calculate in a contract the amount of Token 1, how much do I need to give to get 1000 Tokens 2 ?
For example, I want to buy in the pool WETH/USDC - 3 WETH, how can I calculate the exact amount USDC that I need to pay?
I looked through DODO v2 contracts and didn't find such a function... UniswapV2 has functions getAmountIn and getAmountOut for this, perhaps DODO v2 has similar functions?

DODO Pool DVM contract on the BSC return wrong values for querySell functions

Hi,

I'm not sure I am opening the issue on the right repo. Please let me know if I should open it elsewhere.

Several DODO Pool DVM contract return wrong values for querySellBase or querySellQuote functions. Let me give you one example.

I found the DODO Pool contract for the pair DAI/WBNB from the DVM Factory contract at the address 0x790B4A80Fb1094589A3c0eFC8740aA9b0C1733fB by calling the getDODOPool function with DAI address 0x1af3f329e8be154074d8769d1ffa4ee058b1dbc3 as base token and WBNB address 0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c as quote token, it returns the following DVM contract address 0x0aB58740A864d4ffFdefFa39C24Bf2845CdE9a09.
On the pool DVM contract I run querySellBase with 1 GWEI and it returns 996999989, the querySellQuote returns the same value, this is obviously wrong and if I check on DODO app the exchange rate for DAI/WBNB should be around 0,003941 at time of writing.

Screenshot 2021-03-16 at 21 59 53

Am I doing something wrong?

Edit:
After I checked the pair balance on these pools I see they're almost empty so I guess that explains why I get these rates. Am I correct ?

How to connect every DEX exchange platform

Is this contract the source code of the transaction aggregator contract?

i deploy this code,but i don't understand how to connect every DEX exchange platform?Is this done by contract or by front end?

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.