Author: Tanuj Surve, Cointelegraph; Compiler: Deng Tong, Golden Finance
Once all specified terms or conditions in a contract or agreement are met, smart contracts hosted on the blockchain automatically Execution without intermediary intervention.
Contract terms are written in machine-readable code. Once completed, a smart contract is irreversible and legally binding, which raises the question:Can a smart contract be terminated? More importantly, can smart contracts be reversed?
This article discusses whether a smart contract can be revoked and, if possible, how to revoke a smart contract's access to the cryptocurrency it holds.
What does it mean to cancel a smart contract?
Revoking a smart contract usually means disabling or terminating its functionality on the blockchain. For example, revocation may prevent access to a user's crypto wallet and the ability to move tokens. Additionally, revoking a smart contract stops the ability to view a user’s token balance or public address.
Why will the smart contract be revoked?
People can revoke a smart contract in a variety of circumstances, such as if they do not intend to buy, sell, or transfer the asset or use the smart contract again.
In other cases, malicious developers build backdoors into smart contracts that allow unauthorized access to funds.
Who can change the smart contract?
As with any contract, once the parties agree on the terms of the contract, they cannot be changed. Even if both parties are willing to do so, the terms are written on the blockchain and cannot be changed. This makes smart contracts immutable.
The only way to "change" the terms of a contract is to "upgrade" the contract, that is, replace the underlying smart contract of a decentralized application (DApp) with another. Alternatively, both parties can choose to have an upgradeable contract from the start so that the smart contract can be modified.
Who controls smart contracts?
Once the code is written to the blockchain, no one can control the smart contract. The code will execute if predetermined conditions or regulations are met or verified. The operation involves updating the blockchain and sending notifications. Only parties with access to the smart contract can see transaction details.
Since no one has explicit control over the contract, the parties need to identify the terms and describe them fully without ambiguity to ensure that the contract is enforceable. This begs the question: can tokens be locked in smart contracts? When users send tokens into a smart contract, no one can trade or withdraw them, essentially locking them within it.
Smart contracts will only release tokens after a certain period of time or when certain conditions are met. Some platforms even allow for custom token locks, where users can specify the days and times when tokens will be available.
What are token approvals and permissions in smart contracts?
The only way to prevent smart contracts from being exploited is to only approve withdrawals of the funds required, avoid untested platforms, and revoke token approvals and permissions.
But what are token approvals and permissions? Smart contracts allow DApps to automatically move tokens in their wallets, thereby obtaining token approval and permission. So, token approval and permission means the owner approves the smart contract to withdraw the token from the wallet to perform the transaction. There are several ways that users can revoke smart contract access to their tokens.
Revoking smart contracts through token block explorers
A single network usually has a block explorer, Examples include Polygonscan and Etherscan, which include approval sections where users can revoke permissions and approvals using token approval tools.
The following are the typical steps to take when using the token approval tool, please note that only the address owner can revoke a connected smart contract:
1. Navigate to the token approval page.
2. Enter your address in the search bar and click Search.
3. Smart contracts associated with addresses that can be spent on the username will appear in the asset list, which provides more information about the smart contract's token limit, transaction hash, and token criteria.
4. Click the "Connect to Web3" button to connect to the wallet.
5. Confirm connection Finally, select the contract you want to cancel.
How to revoke token approval and permission for a smart contract on Ethereum
The following are the steps typically taken when revoking a smart contract on the Ethereum mainnet:
Step 1: Access Revoke Tools
Users can use a variety of third-party access revocation tools to track and revoke smart contracts connected to their addresses . Connect to any of the following websites to start the process:
approved.zone: Ethereum
Revoke: Multiple Networks
EverRise: Multiple Networks
- < p>Ethallowance: Ethereum
Unrekt: Multiple Networks
Beefy.finance: BNB Smart Chain
Etherscan: Ethereum
Cointool: Multiple networks
Second Step: Connect Wallet
After connecting to the website, search and click the "Connect Wallet" button. When connecting the website to the wallet, make sure they are on the same network as the revoke access tool only works in one chain.
For example, if connected to the Ethereum mainnet, Polygon smart contracts cannot be revoked because only Ethereum smart contracts are supported and displayed.
Step 3: Select smart contracts
The smart contract tool will display all compatible smart contracts, display its access rights and spending limits. Users should select those contracts they wish to cancel. If unsure, select all and grant new permissions the next time you launch each DApp.
Step 4: Revoke access rights
Click the "Revoke" button, pay the transaction fee, and wait for a while The transaction can be completed in two minutes. Log out and back into the website to confirm that the undo transaction was successful (the smart contract should not appear in the list).
Revoke token access Will permissions also kill DeFi strategies?
No. Users will retain their positions in decentralized finance (DeFi) strategies such as pooling, staking, and lending, allowing them to continue to earn rewards. However, it can have a significant impact on them, depending on the circumstances and how the strategy is structured.
In the DeFi ecosystem, users typically grant smart contracts access to their tokens to enable various functions such as trading, lending, or staking. If a user revokes this access, the smart contract will no longer be able to move or manage the user’s tokens on their behalf.
This action may undermine ongoing strategies that rely on the contract's ability to interact with the token. However, the underlying DeFi policy is not terminated, but is suspended or inactive until access is granted again or the policy is adjusted.
Is disconnecting the wallet from the project the same as canceling the access to funds?
No, they are not the same thing. Disconnecting a wallet from a project will only remove permissions that allow other users to view their token balances, public addresses, and past activity, and will stop transactions from being initiated. But please note that this will not prevent the transaction from being executed.
On the other hand, revoking permission to use funds means revoking the DApp’s permission to access and move the wallet contents.