Reach out for an audit or to learn more about Macro
or Message on Telegram

Glo Dollar A-1

Security Audit

May 25th, 2023

Version 1.0.0

Presented by 0xMacro

Table of Contents

Introduction

This document includes the results of the security audit for Glo Dollar's smart contract code as found in the section titled ‘Source Code’. The security audit was performed by the Macro security team from May 15, 2023 to May 19, 2023.

The purpose of this audit is to review the source code of certain Glo Dollar Solidity contracts, and provide feedback on the design, architecture, and quality of the source code with an emphasis on validating the correctness and security of the software in its entirety.

Disclaimer: While Macro’s review is comprehensive and has surfaced some changes that should be made to the source code, this audit should not solely be relied upon for security, as no single audit is guaranteed to catch all possible bugs.

Overall Assessment

The following is an aggregation of issues found by the Macro Audit team:

Severity Count Acknowledged Won't Do Addressed
Low 1 - - 1
Code Quality 2 1 - 1
Gas Optimization 1 1 - -

Glo Dollar was quick to respond to these issues.

Specification

Our understanding of the specification was based on the following sources:

Trust Model, Assumptions, and Accepted Risks (TMAAR)

Notable features of the contract include minting and burning of GLO tokens, pausability, denylisting, and upgradeability. The contract implements a roles-based access control with dedicated roles for each of the aforementioned functionalities. The roles include:

It is worth noting that each role can be granted to any address which introduces a centralization risk whereby the user of the contract has to trust that all the roles will act faithfully.

Source Code

The following source code was reviewed during the audit:

Specifically, we audited the following contracts within this repository:

Source Code SHA256
USDGLO_V3.sol

758b04d2e304251b702ba08782d553a53f48a14c9d2402e502ea4a9e054d2229

ERC20PermitUpgradeable_V3.sol

c9476c4c60e8aa2877dd58a4dc6c76f844e72b5c58532fcd8d044f59222160a2

ERC20Upgradeable_V2.sol

40c72cb8e00ba58a97a34b4acacfa9fa03a18713c5e39faff492cfe9aa2bdd0e

Note: This document contains an audit solely of the Solidity contracts listed above. Specifically, the audit pertains only to the contracts themselves, and does not pertain to any other programs or scripts, including deployment scripts.

Issue Descriptions and Recommendations

Click on an issue to jump to it, or scroll down to see them all.

Security Level Reference

We quantify issues in three parts:

  1. The high/medium/low/spec-breaking impact of the issue:
    • How bad things can get (for a vulnerability)
    • The significance of an improvement (for a code quality issue)
    • The amount of gas saved (for a gas optimization)
  2. The high/medium/low likelihood of the issue:
    • How likely is the issue to occur (for a vulnerability)
  3. The overall critical/high/medium/low severity of the issue.

This third part – the severity level – is a summary of how much consideration the client should give to fixing the issue. We assign severity according to the table of guidelines below:

Severity Description
(C-x)
Critical

We recommend the client must fix the issue, no matter what, because not fixing would mean significant funds/assets WILL be lost.

(H-x)
High

We recommend the client must address the issue, no matter what, because not fixing would be very bad, or some funds/assets will be lost, or the code’s behavior is against the provided spec.

(M-x)
Medium

We recommend the client to seriously consider fixing the issue, as the implications of not fixing the issue are severe enough to impact the project significantly, albiet not in an existential manner.

(L-x)
Low

The risk is small, unlikely, or may not relevant to the project in a meaningful way.

Whether or not the project wants to develop a fix is up to the goals and needs of the project.

(Q-x)
Code Quality

The issue identified does not pose any obvious risk, but fixing could improve overall code quality, on-chain composability, developer ergonomics, or even certain aspects of protocol design.

(I-x)
Informational

Warnings and things to keep in mind when operating the protocol. No immediate action required.

(G-x)
Gas Optimizations

The presented optimization suggestion would save an amount of gas significant enough, in our opinion, to be worth the development cost of implementing it.

Issue Details

L-1

approve/increaseAllowance/decreaseAllowance don’t revert when contract is paused or address is denylisted

Topic
Spec
Status
Impact
Low
Likelihood
High

Description

According to the documentation, approve/increaseAllowance/decreaseAllowance are supposed to revert when the contract is paused, or a given address is denylisted. This is currently not the case, and thus any address being denylisted can still call one of those functions.

This behavior doesn’t impose any security risks, as the required checks to not allow transfers from and to any denylisted address is checked in the _transfer function.

Remediations to Consider

Consider adding require checks to revert on approve/increaseAllowance/decreaseAllowance when contract is paused or address is denylisted. Alternatively, update documentation accordingly.

Response by Glo Dollar

I'll update the docs. We made the decision not to revert approves on denylists because the transfers check them anyway.

Q-1

Outdated version of OpenZeppelin is used

Topic
Code Quality
Status
Acknowledged
Quality Impact
Low

The project uses OpenZeppelin version 4.7.2 for contracts-upgradeable. There are known vulnerabilities in older version used (see here).

For example ECDSAUpgradeable.sol used in ERC20PermitUpgradable_V3.sol is susceptible to signature malleability. See details here.

Contracts that are affected by this vulnerability are those that implement replay protection by marking the signature itself as used instead of any nonce or unique id.

Thus, with current code, there is no immediate security risk imposed as it uses nonces to prevent replay attacks. However, it is recommended to upgrade to latest stable OpenZeppelin version.

Response by Glo Dollar

Acknowledged - but we prefer to postpone making these changes until our next smart contract upgrade as the issue doesn't introduce any risk, whilst making the changes would require us to rerun checks & delay our preferred timeline.

Q-2

Documentation nitpicks

Topic
Code Quality
Status
Quality Impact
Low
  1. The documentation states the following:

    The internal _mint method checks _requireBalanceIsNotDenylisted on both the minters balance and the to address balance.

    The above statement is not entirely correct as the internal _mint function only checks on the to address. It is the external mint function in USDGLO_V3.sol that also checks on the minter’s address via whenNotDenylisted(_msgSender()).

  2. The documentation mentions the following for the DEFAULT_ADMIN_ROLE:

    This role will be by default assigned to the contract deployer address.

    However, it is not the deployer’s address that will be assigned to the role but instead the admin address being passed in the initialize function.

Consider updating the documentation to correctly reflect behavior.

G-1

Remove extra event for mint and burn

Topic
Gas Optimization
Status
Acknowledged
Gas Savings
Low

USDGLO_V2’s mint and burn functions emit an event Mint(…) and Burn(…) respectively. In addition, the underlying _transfer function also emits an event Transfer(…), resulting in 2 events being emitted for every mint/burn.

In order to reduce gas costs, consider to remove the additional Mint(…) and Burn(…) events.

Response by Glo Dollar

Acknowledged - but we prefer to postpone making these changes until our next smart contract upgrade as the issue doesn't introduce any risk, whilst making the changes would require us to rerun checks & delay our preferred timeline.

Disclaimer

Macro makes no warranties, either express, implied, statutory, or otherwise, with respect to the services or deliverables provided in this report, and Macro specifically disclaims all implied warranties of merchantability, fitness for a particular purpose, noninfringement and those arising from a course of dealing, usage or trade with respect thereto, and all such warranties are hereby excluded to the fullest extent permitted by law.

Macro will not be liable for any lost profits, business, contracts, revenue, goodwill, production, anticipated savings, loss of data, or costs of procurement of substitute goods or services or for any claim or demand by any other party. In no event will Macro be liable for consequential, incidental, special, indirect, or exemplary damages arising out of this agreement or any work statement, however caused and (to the fullest extent permitted by law) under any theory of liability (including negligence), even if Macro has been advised of the possibility of such damages.

The scope of this report and review is limited to a review of only the code presented by the Glo Dollar team and only the source code Macro notes as being within the scope of Macro’s review within this report. This report does not include an audit of the deployment scripts used to deploy the Solidity contracts in the repository corresponding to this audit. Specifically, for the avoidance of doubt, this report does not constitute investment advice, is not intended to be relied upon as investment advice, is not an endorsement of this project or team, and it is not a guarantee as to the absolute security of the project. In this report you may through hypertext or other computer links, gain access to websites operated by persons other than Macro. Such hyperlinks are provided for your reference and convenience only, and are the exclusive responsibility of such websites’ owners. You agree that Macro is not responsible for the content or operation of such websites, and that Macro shall have no liability to your or any other person or entity for the use of third party websites. Macro assumes no responsibility for the use of third party software and shall have no liability whatsoever to any person or entity for the accuracy or completeness of any outcome generated by such software.