-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Attention please! No.35 Proposal will prohibit using TransferContract & TransferAssetContract to transfer TRX and assets to a smart contract account. #2657
Comments
any update for js-sdk? |
This change has nothing to do with js-sdk, but it will affect the transfer transaction of smart contract addresses |
is tronWeb.trx.sendToken still useful for btt /trx transaction? |
You can use it the way you used to, but you can't send it directly to the smart contract address |
Proposal Abstract
No. 35 Proposal for Java-tron Mainnet v3.6.5 covers the following five updates:
The third update need special attention, which impacts and scopes are illustrated as follows:
Who will be affected?
Wallets, Exchanges and DApp developers
After the proposal comes into force, transfer will fail and won't be recorded on the chain, nor will it consume additional Bandwidth and Energy when Wallet users, DApp developers and exchanges transfer TRX or TRC10 tokens to smart contract addresses by two system contract TransferContract and TransferAssetContract.
What about the existing contracts?
Existing contracts will no longer support TRX and TRC10 tokens deposit by TransferContract and TransferAssetContract. Therefore, smart contract developers should reserve functions of payable or payable fallback for the contracts when they are coding.
Compatible approaches for the existing contracts
Transfer TRX/TRC10 to deployed smart contracts using the following approaches:
Deposit by calling the fallback of contracts
In principle, we recommend developers reserve deposit function for contracts. For contracts already deployed, developers could then deploy the following codes to deposit on the target contracts in suicide approach.
// solidity source code
pragma solidity 0.5.8;
contract ForceTransfer{
constructor(address payable toAddress) public payable{
selfdestruct(toAddress);
}
}
// compiling parameter:--optimize --optimize-runs=200
// compiler:TRON 0.5.8 compiler https://github.com/tronprotocol/solidity/releases
// Binary:
6080604052604051602080603083398101806040526020811015602157600080fd5b50516001600160a01b038116fffe
Contract JSON ABI
[{"inputs":[{"name":"toAddress","type":"address"}],"payable":true,"stateMutability":"payable","type":"constructor"}]
Developers could then force transfer to the target address TAAAAAAAAAAAAAAA in the following ways:
Transfer x amount of TRX, y amount of z TRC10 tokens to the target contract address TAAAAAAAAAAAAAAA
deploycontract ForceTransfer [] 6080604052604051602080603083398101806040526020811015602157600080fd5b50516001600160a01b038116fffe ForceTransfer(address) "TAAAAAAAAAAAAAAA" false 10000000 0 10000000 x y z
Transfer x TRX to the target contract address TAAAAAAAAAAAAAAA
deploycontract ForceTransfer [] 6080604052604051602080603083398101806040526020811015602157600080fd5b50516001600160a01b038116fffe ForceTransfer(address) "TAAAAAAAAAAAAAAA" false 10000000 0 10000000 x 0 #
Transfer y amount of z TRC10 tokens to the target contract address TAAAAAAAAAAAAAAA
deploycontract ForceTransfer [] 6080604052604051602080603083398101806040526020811015602157600080fd5b50516001600160a01b038116fffe ForceTransfer(address) "TAAAAAAAAAAAAAAA" false 10000000 0 10000000 0 y z
The text was updated successfully, but these errors were encountered: