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
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
add a comment |
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
add a comment |
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
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
solidity contract-development contract-design
asked Apr 13 at 14:14
AbkAbk
1083
1083
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
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.
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
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
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.
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
add a comment |
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.
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
add a comment |
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.
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.
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
add a comment |
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
add a comment |
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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