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

Attention please! No.35 Proposal will prohibit using TransferContract & TransferAssetContract to transfer TRX and assets to a smart contract account. #2657

Closed
Sh11thead opened this issue Nov 18, 2019 · 4 comments

Comments

@Sh11thead
Copy link
Contributor

Sh11thead commented Nov 18, 2019

Proposal Abstract

No. 35 Proposal for Java-tron Mainnet v3.6.5 covers the following five updates:

  1. Adding a new Virtual Machine instruction to identify smart contract accounts (TIP#44 address add isContract member #2323)
  2. Allowing automatic activation of inactive accounts when transferring TRX/ TRC10 tokens to accounts in smart contracts (TIP#54 Feature/v3.6.5 create account when transfer #2439)
  3. Prohibiting using TransferContract & TransferAssetContract to transfer TRX and assets to smart contract account(TIP#37 Feature/v3.6.5 disable transfer to smartaddress #2445 )
  4. Adding a new Virtual Machine instruction to support bulk verification of signatures, speeding up the verification process and reducing Energy consumption (TIP#43 Feature/newmultisign #2422)
  5. Adding a new Virtual Machine instruction to support multi-signature verification (TIP#60 Feature/v3.6.5 addvalimutisign #2471)

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:

  1. For contracts with the function of payable fallback
    Deposit by calling the fallback of contracts
  2. For contracts without payable functions
    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:

  1. 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

  2. Transfer x TRX to the target contract address TAAAAAAAAAAAAAAA
    deploycontract ForceTransfer [] 6080604052604051602080603083398101806040526020811015602157600080fd5b50516001600160a01b038116fffe ForceTransfer(address) "TAAAAAAAAAAAAAAA" false 10000000 0 10000000 x 0 #

  3. 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

@jiangyy0824 jiangyy0824 changed the title No.32 Proposal about [ Prohibit using TransferContract & TransferAssetContract to transfer TRX and assets to smart contract account]. Attention please! No.32 Proposal would prohibit using TransferContract & TransferAssetContract to transfer TRX and assets to smart contract account. Nov 18, 2019
@jiangyy0824 jiangyy0824 changed the title Attention please! No.32 Proposal would prohibit using TransferContract & TransferAssetContract to transfer TRX and assets to smart contract account. Attention please! No.32 Proposal will prohibit using TransferContract & TransferAssetContract to transfer TRX and assets to a smart contract account. Nov 18, 2019
@lijianl
Copy link

lijianl commented Dec 2, 2019

any update for js-sdk?

@Sh11thead
Copy link
Contributor Author

Sh11thead commented Dec 2, 2019

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

@lijianl
Copy link

lijianl commented Dec 2, 2019

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?

@Sh11thead
Copy link
Contributor Author

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

@BlueHoopor BlueHoopor changed the title Attention please! No.32 Proposal will prohibit using TransferContract & TransferAssetContract to transfer TRX and assets to a smart contract account. Attention please! No.35 Proposal will prohibit using TransferContract & TransferAssetContract to transfer TRX and assets to a smart contract account. Jan 3, 2020
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

3 participants