Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement selfDesctruct in the WebSite SC #199

Open
pivilartisant opened this issue Dec 19, 2024 · 1 comment
Open

Implement selfDesctruct in the WebSite SC #199

pivilartisant opened this issue Dec 19, 2024 · 1 comment

Comments

@pivilartisant
Copy link
Collaborator

pivilartisant commented Dec 19, 2024

Implement a self destruct function in the website SC. This should allow users to completely remove their SC from deployment and by extension remove it from the indexer list.

See function below.

Changes should also be propagated to:

  • cli add new Self_Destruct function
  • ui -> unclear what to do ? should be followed up
  • docs -> explain self destruct, differences with delete

More:

  • we should also think about adding a command in the cli that will allow users to upgrade their deployed smart contracts
@pivilartisant
Copy link
Collaborator Author

pivilartisant commented Dec 19, 2024

Function should look something like this:

  onlyowner();
  if( !website_empty() ) {
      raise "website not empty, please clear all files first";
      // this check ensures that the self destruct function won't take an infinite amount of gas and fail if there are 10000000 files to delete
  }
  owner = get_owner();
  // TODO delete the Owner datastore entry
  // TODO delete all website-level metadata
  if storage.has("DEWEB_VERSION") {
    storage.del("DEWEB_VERSION");
  }
  set_bytecode("")
  if(owner != "") {
     transfer_coins(get_balance(), owner);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant