TrueUSD Planned Token Upgrade

TrueFi
TrueFi
Published in
4 min readDec 5, 2018

Summary

  • The TUSD smart contract was upgraded on Jan 3rd to include several new features for traders, exchanges, and developers
  • The new smart contract address is 0x0000000000085d4780B73119b644AE5ecd22b376
  • All TUSD has been automatically moved over
  • You do not need to do anything to upgrade your TUSD
  • If you are a TUSD trader or holder, there is nothing you need to do. Going forward, use the new smart contract address for transferring your TUSD and checking your balance.
  • If you run an exchange or app, please update your code to the new smart contract address if you haven’t already done so.
  • We do not expect to have to change the address again going forward

[Special note for if you run a decentralized exchange or dapp: we understand that you might not be able to update to the new address and we anticipated this. The old address continues to work, it just forwards all calls such as transfer() to the new address.]

Upgrade Details

Before making major changes to our contracts, we will always give sufficient notice. On January 3rd, 2019 at 7:00PM Pacific time, we will be performing a contract upgrade using the DelegateERC20 feature of TrueUSD. The old contract will continue to function without disruption; however, after the upgrade, ERC20 events will only be emitted from the new contract. For exchanges and apps that do not monitor ERC20 events, no action is required, although we recommend directly using the newer contract once it is available because it will require less gas than the original. For exchanges and apps that do monitor ERC20 events, an upgrade is required. The new address of TrueUSD will be 0x0000000000085d4780B73119b644AE5ecd22b376.

Reasons for the Upgrade

This upgrade includes several large features that improve TrueUSD:

  • Lower gas cost for TrueUSD transfers
  • Easier process for redeeming TrueUSD
  • Improved upgrade process to make future upgrades seamless
  • Additional features to help OTC desks, traders, and exchanges use TrueUSD

Who Needs to Upgrade

This upgrade only impacts parties monitoring TrueUSD’s ERC20 events. Events are blockchain notes that help exchanges and apps monitor smart contracts. After the upgrade, all future TrueUSD ERC20 events will emit from the new contract. TrueUSD token trackers should either watch both addresses, which would together compose the whole history, or watch for the DelegatedTo event, which signals the transition.

If your exchange or app monitors for incoming deposits by watching for Transfer events to its deposit addresses, our upgrade will break that flow, requiring changes to the deposit tracker. The next section will cover possible upgrades.

How to Upgrade your Exchange or App

Replace in your code any instances of the old TrueUSD address (0x8dd5fbce2f6a956c3022ba3663759011dd51e73e) with the new TrueUSD address (0x0000000000085d4780B73119b644AE5ecd22b376).

If you missed some events between when the TrueUSD upgrade happened and when your code was updated, here is an example script that would fetch the events from that period of time. This example uses the Ethereum JSON API.

function fetchDeposits({startBlockNumber, endBlockNumber, depositAddresses }) {
const req = new XMLHttpRequest();
req.onreadystatechange = () => {
if (req.readyState == 4) {
const results = JSON.parse(req.responseText).result;
for (let index in results) {
const result = results[index];
console.log({
amount: result.data,
depositAddress: result.topics[2],
blockNumber: result.blockNumber
});
}
}
};
req.open('POST', ethJsonRPC, true);
req.send(JSON.stringify({
"jsonrpc": "2.0",
"method": "eth_getLogs",
"params": [{
"topics":[
/* ERC20 Transfer */ '0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef',
/* from */ null,
/* to */ depositAddresses
],
"address": '0x0000000000085d4780B73119b644AE5ecd22b376',
"fromBlock": web3.utils.toHex(startBlockNumber),
"toBlock": web3.utils.toHex(endBlockNumber)
}],
"id": nextRequestId()
}));
}

Hopefully these suggestions have been useful. Please leave a comment if you have any questions, or reach out to exchange-support@trusttoken.com.

Q&A

What time is the TrueUSD upgrade happening in my timezone?

For convenience, here is the upgrade time converted into several major timezones.

  • San Francisco: January 3rd, 2019 at 7:00PM PST
  • New York: January 3rd, 2019 at 10:00PM EST
  • London: January 4th, 2019 at 3:00AM GMT
  • Hong Kong: January 4th, 2019 at 11:00AM HKT
  • Tokyo: January 4th, 2019 at 12:00PM (noon) JST

Why does the new TrueUSD address start with 11 zeros?

This is a security feature which makes it easier to remember the TrueUSD address so you know you are interacting with the right smart contract when signing transactions.

If, for example, you remember that the address begins with 11 zeros and then 85d478, you have remembered a total of 17 digits. It is difficult (but not impossible) for an attacker to make an address that matches these 17 digits.

If my exchange or app monitors ERC20 events, will I need to make more upgrades in the future?

This upgrade includes improvements to the TrueUSD upgrade system itself. The improved upgrade system should allow us to upgrade TrueUSD without you needing to make any changes to your exchange or app going forward.

--

--

TrueFi
TrueFi

Building TrueFi, the world’s largest credit protocol | $1.7B originated, industry leading underwriting record | Visit truefi.io to lend or launch your portfolio