by Aleksey Shmatov Coinbase its first stablecoin tied to the US Dollar. We have entered a new era of legitimate stablecoins. USDC issued by Circle, which is backed by Goldman Sachs. Making it as official and legal as it can be compared to shady Tether. adds Contrary to Tether, which is implemented on Bitcoin’s Omni layer, USDC implements on Ethereum as an ERC-20 Token. Written by USDC source code on GitHub and has a decent . The source code is verified on . Let’s take a look. centre.io available documentation etherscan Proxy Contract Original points to the , written by OpenZeppelin. Essentially it enables admin to replace the implementation of USDC with whatever code at any time. That totally destroys entire point of EVM contracts immutability and thus trustlessness of smart contract. In other words, . I guess old banks really like to keep power in their hands to screw anyone at any time. address proxy contract USDC is 100% trust based venture Yet at the same, it represents a for USDC itself. In case admin private key is stolen, entire USDC token can be destroyed and all users/balances lost, because a new contract can overwrite data on purpose. That would be a catastrophe. critical point of failure ERC-20 The proxy itself points to ERC-20 Token implementation. The is available and verified on etherscan. The contract is called and it is a custom implementation of ERC-20 Token heavy influenced by OpenZeppelin with the addition of many features. code FiatTokenV1 contract FiatTokenV1 is Ownable, ERC20, Pausable, Blacklistable FiatTokenV1 implements ERC-20 protocol with few exceptions: A blacklisted address will be unable to call transfer, transferFrom, or approve, and will be unable to receive tokens. transfer, transferFrom, and approve will fail if the contract has been paused. In other words, , rendering his funds useless. And . they can kick out anyone from the system they can stop entire USDC token from moving anything Governance What I really like about FiatTokenV1 is a separation of roles. It defines the following roles: masterMinter — adds and removes minters and increases their minting allowance minters — create and destroy tokens pauser — pause the contract, which prevents all transfers, minting, and burning blacklister — prevent all transfers to or from a particular address, and prevents that address from minting or burning owner — re-assign any of the roles except for admin admin — upgrade the contract, and re-assign itself Such model looks like proper governance on blockchain! Again compare to Tether there, essentially one company/person probably runs it all. We have a clear separation of jobs here baked into a smart contract. Implementation Details Let’s dig into the source code. We are not going to cover implementations of Ownable, Pausable and Blacklistable, because they are trivial. Instead, we focus on FiatTokenV1. The first thing which seems strange as that all variables named using camelCase notation, like , and etc. Yet has the underscore at the end. This is confusing. It is not consistent with other fields and contradicts OpenZeppelin notation of using an underscore at the start to mark contract's fields . internal balances allowed totalSupply_ _field Moreover, FiatTokenV1 use the notation for some functions and for other. Highly inconsistent. _parameter parameter I would say it probably caused by different people writing different parts of the code, but I don’t see why it can be reviewed and fixed. FiatTokenV1 is inconsistent with its assertions as well. At some functions, it does check for addresses not being , but at some, it doesn't. Proof. 0 Again, it is just inconsistent and may lead to confusion and mistakes in the future. Canonical by OpenZeppelin does check for address equality every time. ERC-20 implementation 0 defines the order of functions. I understand it is just a recommendation, but FiatTokenV1 has all its functions mixed up. They go in the following order: Solidity Style Guide constructor modifier public modifier public … I believe it is reasonable to put some effort in 200 lines of code, which are going to handle billions of dollars on daily basis. There are a decent amount of on GitHub, which is always a good thing. I haven’t looked too much into them. tests Attack Vectors Only three roles represent obvious attack target: admin, owner, and masterMinter. One way or another they all can provide access to minting USDC to an attacker. Assuming that in the near future USDC will be supported on many exchanges including decentralized exchanges. The attacker can quickly swap USDC for Monero or other private coins. As a result, constant monitoring of these address has to be established in order to prevent such things. In the case of admin role, things are even worse. Admin can actually replace the contract with attacker’s contract, which may corrupt user’s balances and other data. Recovery can take a lot of time using logs and be questionable. Also, only the admin key can resolve issues with owner/masterMinter key. Because of that protection of admin private key is critical for whole USDC token ecosystem. Conclusion Circe’s USDC is an ERC-20 implementation of stablecoin bound to US Dollar. Looking at Tether success as a trading currency, USDC may have even more success being supported by Coinbase and Goldman Sachs. It is crucial for all parties involved to have a clear understanding of technical nuances because they matter in the blockchain world. Infamous example is Parity wallet . We do not want our money stuck one day due to someone stealing admin private key. hacks TL;DR Uses proxy contract for upgradability. Provides transparency and interoperability. God separation of governance using roles model. Implemented as ERC-20 Token. Users can be blacklisted and the whole Token can be paused. Proxy contract model is a critical vulnerability because it allows to replace the contract with completely new contract and erase/rewrite all data. If this post was helpful, please click the clap 👏button below a few times to show your support! ⬇⬇ Social Connect with me on . LinkedIn Follow me on . twitter Read More _We are going to figure out what is EOS token and how you can create and deploy one yourself._hackernoon.com How to Create and Deploy Your Own EOS Token _You think your AWS or Digital Ocean bill for your website is killing you?_hackernoon.com How Much Does It Cost to Run DApp in 2018 Originally published at ylv.io on October 29, 2018.