How to prevent selfdestruct from another contractHow to prevent an attack on a contract creation serviceContract calling another contractWill contract selfdestruct also return tokens?how to call one contract function into another contractThis contract does not implement all functions and thus cannot be createdWhat is a standard implementation of upgradable ethereum Token contractIf a contract's function calls a function of another contract within it, is the address of the contract the msg.sender?Is it possible to run out of gas in a method before reaching the self-destruct call?msg.sender problem for calling ERC20 token contract from another contractremix ERC223: This contract does not implement all functions and thus cannot be created

What environment would goblins be best adapted for?

Is this story about US tax office reasonable?

Break equation in parts

What is a subpixel in Super Mario Bros, and how does it relate to wall clipping?

Crossword gone overboard

Inverter Power draw from 12V battery

What's the connection between "kicking a pigeon" and "how a bill becomes a law"?

Ticket sales for Queen at the Live Aid

Why does the 6502 have the BIT instruction?

Is it possible to change original filename of an exe?

Black-and-white film where monster/alien gets fried

Do firearms count as ranged weapons?

How do I subvert the tropes of a train heist?

Can a non-EU citizen travel within schengen zone freely without passport?

If a massive object like Jupiter flew past the Earth how close would it need to come to pull people off of the surface?

Tic-Tac-Toe for the terminal

Canon 70D often overexposing or underexposing shots

Where do I put diamond mines on my map?

A Mathematical Discussion: Fill in the Blank

What caused the tendency for conservatives to not support climate change reform?

Is it ok to put a subplot to a story that is never meant to contribute to the development of the main plot?

Modern approach to radio buttons

Future enhancements for the finite element method

Smart people send dumb people to a new planet on a space craft that crashes into a body of water



How to prevent selfdestruct from another contract


How to prevent an attack on a contract creation serviceContract calling another contractWill contract selfdestruct also return tokens?how to call one contract function into another contractThis contract does not implement all functions and thus cannot be createdWhat is a standard implementation of upgradable ethereum Token contractIf a contract's function calls a function of another contract within it, is the address of the contract the msg.sender?Is it possible to run out of gas in a method before reaching the self-destruct call?msg.sender problem for calling ERC20 token contract from another contractremix ERC223: This contract does not implement all functions and thus cannot be created













1















I have a contract A calling another contract B



Contract A



contract A 

function sendValue(B _externalContract, uint _value)
_externalContract.acceptValue(_value);



contract B
function acceptValue(unit value);



Contract B (contract A expect contract B acceptValue to be safe)



 contract B 
function acceptValue(unit _value)
dosomethingWith(_value)




If a malicious user now design contract B function acceptValue to self destruct like so



Contract B



 contract B 
function acceptValue(unit _value)
selfdestruct(msg.sender);




  • Will that function destroy my contract A or malicious user Contract B?

  • Is there a check I can perform in contract A sendValue to prevent that?









share|improve this question


























    1















    I have a contract A calling another contract B



    Contract A



    contract A 

    function sendValue(B _externalContract, uint _value)
    _externalContract.acceptValue(_value);



    contract B
    function acceptValue(unit value);



    Contract B (contract A expect contract B acceptValue to be safe)



     contract B 
    function acceptValue(unit _value)
    dosomethingWith(_value)




    If a malicious user now design contract B function acceptValue to self destruct like so



    Contract B



     contract B 
    function acceptValue(unit _value)
    selfdestruct(msg.sender);




    • Will that function destroy my contract A or malicious user Contract B?

    • Is there a check I can perform in contract A sendValue to prevent that?









    share|improve this question
























      1












      1








      1








      I have a contract A calling another contract B



      Contract A



      contract A 

      function sendValue(B _externalContract, uint _value)
      _externalContract.acceptValue(_value);



      contract B
      function acceptValue(unit value);



      Contract B (contract A expect contract B acceptValue to be safe)



       contract B 
      function acceptValue(unit _value)
      dosomethingWith(_value)




      If a malicious user now design contract B function acceptValue to self destruct like so



      Contract B



       contract B 
      function acceptValue(unit _value)
      selfdestruct(msg.sender);




      • Will that function destroy my contract A or malicious user Contract B?

      • Is there a check I can perform in contract A sendValue to prevent that?









      share|improve this question














      I have a contract A calling another contract B



      Contract A



      contract A 

      function sendValue(B _externalContract, uint _value)
      _externalContract.acceptValue(_value);



      contract B
      function acceptValue(unit value);



      Contract B (contract A expect contract B acceptValue to be safe)



       contract B 
      function acceptValue(unit _value)
      dosomethingWith(_value)




      If a malicious user now design contract B function acceptValue to self destruct like so



      Contract B



       contract B 
      function acceptValue(unit _value)
      selfdestruct(msg.sender);




      • Will that function destroy my contract A or malicious user Contract B?

      • Is there a check I can perform in contract A sendValue to prevent that?






      solidity contract-development contract-design






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 13 at 14:14









      AbkAbk

      1083




      1083




















          1 Answer
          1






          active

          oldest

          votes


















          3














          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.






          share|improve this answer























          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46











          Your Answer








          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "642"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f69620%2fhow-to-prevent-selfdestruct-from-another-contract%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.






          share|improve this answer























          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46















          3














          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.






          share|improve this answer























          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46













          3












          3








          3







          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.






          share|improve this answer













          It destroys Contract B and sends B's Eth balance to contract A, if called from A.



          There is no way B can destroy A. Otherwise, there would be chaos.



          Hope it helps.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 13 at 14:50









          Rob HitchensRob Hitchens

          30.2k74585




          30.2k74585












          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46

















          • Thanks for the answer. It helps a lot.

            – Abk
            Apr 13 at 17:53











          • My pleasure. Thanks for accepting my answer.

            – Rob Hitchens
            Apr 14 at 2:46
















          Thanks for the answer. It helps a lot.

          – Abk
          Apr 13 at 17:53





          Thanks for the answer. It helps a lot.

          – Abk
          Apr 13 at 17:53













          My pleasure. Thanks for accepting my answer.

          – Rob Hitchens
          Apr 14 at 2:46





          My pleasure. Thanks for accepting my answer.

          – Rob Hitchens
          Apr 14 at 2:46

















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Ethereum Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fethereum.stackexchange.com%2fquestions%2f69620%2fhow-to-prevent-selfdestruct-from-another-contract%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Distance measures on a map of a game The 2019 Stack Overflow Developer Survey Results Are Inmin distance in a graphShortest distance path on contour plotHow to plot a tilted map?Finding points outside of a diskDelaunay link distanceAnnulus from GeoDisks: drawing a ring on a mapNegative Correlation DistanceFind distance along a path (GPS coordinates)Finding position at given distance in a GeoPathMathematics behind distance estimation using camera

          Genealogie vun de Merowenger Vum Merowech bis zum Chilperich I. | Navigatiounsmenü

          How to get a smooth, uniform ParametricPlot of a 2D Region?How to plot a complicated Region?How to exclude a region from ParametricPlotHow discretize a region placing vertices on a specific non-uniform gridHow to transform a Plot or a ParametricPlot into a RegionHow can I get a smooth plot of a bounded region?Smooth ParametricPlot3D with RegionFunction?Smooth border of a region ParametricPlotSmooth region boundarySmooth region plot from list of pointsGet minimum y of a certain x in a region