paxosglobal / busd-contract

Solidity smart contracts for the BUSD stablecoin
MIT License
141 stars 89 forks source link

Rename smart contract from Binance USD to BUSD #43

Closed henryksarat closed 1 year ago

henryksarat commented 1 year ago

Changelog

Running the following command yielded no matches from the root directory: grep -Ril "binance" .

make all:

yarn install
yarn install v1.22.5
warning ../../../../../package.json: No license field
[1/4] 🔍  Resolving packages...
success Already up-to-date.
✨  Done in 0.27s.

> busd@0.0.1 solium
> solium -d contracts/ --fix

No issues found.

> busd@0.0.1 compile
> truffle compile

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

> busd@0.0.1 truffle-abi
> cat build/contracts/BUSDImplementation.json | jq -c .abi > BUSD.abi

> busd@0.0.1 truffle-bin
> cat build/contracts/BUSDImplementation.json | jq  -r .bytecode > BUSD.bin

> busd@0.0.1 flatten-impl
> truffle-flattener ./contracts/BUSDImplementation.sol > ./flattened/BUSDImplementation.sol

(node:68652) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:68652) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency

> busd@0.0.1 flatten-proxy
> truffle-flattener ./contracts/zeppelin/AdminUpgradeabilityProxy.sol > ./flattened/AdminUpgradeabilityProxy.sol

(node:68844) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:68844) Warning: Accessing non-existent property 'INVALID_ALT_NUMBER' of module exports inside circular dependency

> busd@0.0.1 coverage
> truffle run coverage --network coverage

> Using Truffle library from local node_modules.

> server:            http://127.0.0.1:8555
> truffle:           v5.4.29
> ganache-core:      v2.13.0
> solidity-coverage: v0.7.14

Network Info
============
> id:      *
> port:    8555
> network: coverage

Instrumenting for coverage...
=============================

> BUSDImplementation.sol
> zeppelin/AddressUtils.sol
> zeppelin/AdminUpgradeabilityProxy.sol
> zeppelin/Proxy.sol
> zeppelin/SafeMath.sol
> zeppelin/UpgradeabilityProxy.sol

Coverage skipped for:
=====================

> Migrations.sol
> mocks/BUSDWithBalance.sol
> mocks/SafeMathMock.sol

Compiling your contracts...
===========================
> Compiling ./.coverage_contracts/BUSDImplementation.sol
> Compiling ./.coverage_contracts/Migrations.sol
> Compiling ./.coverage_contracts/mocks/BUSDWithBalance.sol
> Compiling ./.coverage_contracts/mocks/SafeMathMock.sol
> Compiling ./.coverage_contracts/zeppelin/AddressUtils.sol
> Compiling ./.coverage_contracts/zeppelin/AdminUpgradeabilityProxy.sol
> Compiling ./.coverage_contracts/zeppelin/Proxy.sol
> Compiling ./.coverage_contracts/zeppelin/SafeMath.sol
> Compiling ./.coverage_contracts/zeppelin/UpgradeabilityProxy.sol
> Compilation warnings encountered:

    project:/.coverage_contracts/zeppelin/SafeMath.sol:9:23: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
function c_0xd904add3(bytes32 c__0xd904add3) public pure {}
                      ^-------------------^
,project:/.coverage_contracts/BUSDImplementation.sol:21:23: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
function c_0xfc75fc1c(bytes32 c__0xfc75fc1c) public pure {}
                      ^-------------------^
,project:/.coverage_contracts/zeppelin/AddressUtils.sol:8:23: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
function c_0x93dfc96a(bytes32 c__0x93dfc96a) public pure {}
                      ^-------------------^
,project:/.coverage_contracts/zeppelin/Proxy.sol:11:23: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
function c_0x8aa665da(bytes32 c__0x8aa665da) public pure {}
                      ^-------------------^
,project:/.coverage_contracts/zeppelin/UpgradeabilityProxy.sol:13:23: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
function c_0xc8262f2c(bytes32 c__0xc8262f2c) public pure {}
                      ^-------------------^
,project:/.coverage_contracts/zeppelin/AdminUpgradeabilityProxy.sol:14:23: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
function c_0xd5391848(bytes32 c__0xd5391848) public pure {}
                      ^-------------------^
,project:/.coverage_contracts/zeppelin/AdminUpgradeabilityProxy.sol:70:36: Warning: Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
 ... ifAdmin ...
     ^-----^
,project:/.coverage_contracts/zeppelin/AdminUpgradeabilityProxy.sol:80:45: Warning: Function declared as view, but this expression (potentially) modifies the state and thus requires non-payable (the default) or payable.
 ... ifAdmin ...
     ^-----^
,project:/.coverage_contracts/zeppelin/Proxy.sol:63:5: Warning: Function state mutability can be restricted to pure
    function _willFallback() internal {c_0x8aa665da(0x25c3eec453ced9a693130c576b94cc08e47f42a03806cc3e85e6c2564de9b62a); /* function */
    ^ (Relevant source part starts here and spans across multiple lines).

> Artifacts written to /Users/henryksarat/go/src/github.com/paxosglobal/busd-contract/.coverage_artifacts/contracts
> Compiled successfully using:
   - solc: 0.4.24+commit.e67f0147.Emscripten.clang

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.

  Contract: CanReclaimFunds
    ✓ should not accept Eth (144ms)
    ✓ should allow owner to reclaim tokens (52ms)
    ✓ should allow only owner to reclaim tokens (131ms)

  Contract: BUSD
    when the asset protection role is unset
      ✓ reverts asset protection actions (88ms)
    as a asset-protection token
      after setting the AssetProtectionRole
        ✓ the current asset Protection role is set
      freeze
        ✓ reverts when sender is not asset protection
        ✓ adds the frozen address
        ✓ emits an AddressFrozen event
        ✓ reverts when address is already frozen (52ms)
        when frozen
          ✓ reverts when transfer is from frozen address
          ✓ reverts when transfer is to frozen address
          ✓ reverts when transferFrom is by frozen address
          ✓ reverts when transferFrom is from frozen address
          ✓ reverts when transferFrom is to frozen address
          ✓ reverts when approve is from the frozen address
          ✓ reverts when approve spender is the frozen address
      unfreeze
        ✓ reverts when address is already unfrozen
        when already frozen
          ✓ reverts when sender is not asset protection
          ✓ removes a frozen address
          ✓ unfrozen address can transfer again (120ms)
          ✓ emits an AddressFrozen event
      wipeFrozenAddress
        ✓ reverts when address is not frozen
        when already frozen with assets and approvals
          ✓ reverts when sender is not asset protection
          ✓ wipes a frozen address balance (45ms)
          ✓ emits an FrozenAddressWiped event
      setAssetProtectionRole
        ✓ reverts if sender is not owner or AssetProtectionRole (55ms)
        ✓ works if sender is AssetProtectionRole (40ms)
        ✓ enables new AssetProtectionRole to freeze (54ms)
        ✓ prevents old AssetProtectionRole from freezing (52ms)
        ✓ emits a AssetProtectionRoleSet event

  Contract: BetaDelegatedTransfer BUSD
    as a token with delegated transfer
      ✓ can do a delegated transfer (167ms)
      ✓ fails for bad signatures
      ✓ fails for bad seq (46ms)
      ✓ fails for insufficient balance (46ms)
      ✓ fails for expired blockNumber (39ms)
      ✓ does not allow zero value with zero fee
      ✓ fails for a non-whitelisted address
      ✓ Handles zero fee without a fee transfer event (69ms)
      with multiple delegated transfers
        ✓ can do two delegated transfers (247ms)
        ✓ can do two delegated transfers in a batch (87ms)
        ✓ reverts batches to act atomically (105ms)
    as a token with a delegate whitelister
      ✓ can whitelist an delegate/executor (63ms)
      ✓ can unwhitelist (67ms)
      ✓ whitelister can set new whitelister
      ✓ non-whitelister who is not owner cannot set new whitelister or whitelist/unwhitelist (109ms)
      ✓ cannot set whitelister to address zero

  Contract: ERC20Basic BUSD
    basic data
      ✓ has getters for the name, symbol, and decimals
    total supply
      ✓ returns the total amount of tokens
    balanceOf
      when the requested account has no tokens
        ✓ returns zero
      when the requested account has some tokens
        ✓ returns the total amount of tokens
    transfer
      when the recipient is not the zero address
        when the sender does not have enough balance
          ✓ reverts
        when the sender has enough balance
          ✓ transfers the requested amount (64ms)
          ✓ emits a transfer event
      when the recipient is the zero address
        ✓ reverts

  Contract: ERC20 BUSD
    approve
      when the spender is not the zero address
        when the sender has enough balance
          ✓ emits an approval event
          when there was no approved amount before
            ✓ approves the requested amount
          when the spender had an approved amount
            ✓ approves the requested amount and replaces the previous one (39ms)
        when the sender does not have enough balance
          ✓ emits an approval event
          when there was no approved amount before
            ✓ approves the requested amount
          when the spender had an approved amount
            ✓ approves the requested amount and replaces the previous one (51ms)
      when the spender is the zero address
        ✓ approves the requested amount
        ✓ emits an approval event
    transfer from
      when the recipient is not the zero address
        when the spender has enough approved balance
          when the owner has enough balance
            ✓ transfers the requested amount (65ms)
            ✓ decreases the spender allowance
            ✓ emits a transfer event
          when the owner does not have enough balance
            ✓ reverts
        when the spender does not have enough approved balance
          when the owner has enough balance
            ✓ reverts
          when the owner does not have enough balance
            ✓ reverts
      when the recipient is the zero address
        ✓ reverts

  Contract: Ownable BUSD
    as an ownable
      ✓ should have an owner
      ✓ sets new potential owner after proposeOwner
      ✓ allows owner to removes proposed owner after disregardProposeOwner (60ms)
      ✓ allows proposed to removes proposed owner after disregardProposeOwner (123ms)
      ✓ should prevent current owner from proposing itself as new owner (46ms)
      ✓ should prevent non-proposed owners from calling disregardProposeOwner (59ms)
      ✓ should prevent calling disregardProposeOwner if there is no proposed owner to disregard
      ✓ sets new owner after completeTransferOwnership (59ms)
      ✓ should prevent non-owners from transferring ownership
      ✓ should prevent non-proposedOwners from finishing transferring ownership (64ms)
      ✓ should guard ownership against stuck state
    as an initializable token
      ✓ you should not be able to initialize a second time
      ✓ constructor initializes the implementation contract and pauses it to avoid misleading state there

  Contract: Pausable BUSD
    ✓ can transfer in non-pause (46ms)
    ✓ cannot transfer in pause (79ms)
    ✓ cannot approve/transferFrom in pause (109ms)
    ✓ should resume allowing normal process after pause is over (151ms)
    ✓ cannot unpause when unpaused or pause when paused (90ms)

  Contract: SafeMath
    add
      ✓ adds correctly
      ✓ reverts on addition overflow
    sub
      ✓ subtracts correctly
      ✓ reverts if subtraction result would be negative

  Contract: BUSD
    as a supply-controlled token
      after token creation
        ✓ sender should be token owner
        ✓ sender should be supply controller
        ✓ total supply should be zero
        ✓ balances should be zero
      increaseSupply
        ✓ reverts when sender is not supply controller
        ✓ adds the requested amount (44ms)
        ✓ emits a SupplyIncreased and a Transfer event
        ✓ cannot increaseSupply resulting in positive overflow of the totalSupply (97ms)
      decreaseSupply
        when the supply controller has insufficient tokens
          ✓ reverts
        when the supply controller has sufficient tokens
          ✓ reverts when sender is not supply controller (55ms)
          ✓ removes the requested amount (39ms)
          ✓ emits a SupplyDecreased and a Transfer event
      setSupplyController
        ✓ reverts if sender is not owner or supplyController
        ✓ works if sender is supply controller
        ✓ reverts if newSupplyController is address zero
        ✓ enables new supply controller to increase and decrease supply (121ms)
        ✓ prevents old supply controller from increasing and decreasing supply (54ms)
        ✓ emits a SupplyControllerSet event

  109 passing (29s)

-------------------------------|----------|----------|----------|----------|----------------|
File                           |  % Stmts | % Branch |  % Funcs |  % Lines |Uncovered Lines |
-------------------------------|----------|----------|----------|----------|----------------|
 contracts/                    |      100 |    90.43 |      100 |      100 |                |
  BUSDImplementation.sol       |      100 |    90.43 |      100 |      100 |                |
 contracts/zeppelin/           |    76.47 |    57.14 |    76.19 |    80.49 |                |
  AddressUtils.sol             |      100 |      100 |      100 |      100 |                |
  AdminUpgradeabilityProxy.sol |     62.5 |     37.5 |       60 |    68.42 |... 63,83,97,98 |
  Proxy.sol                    |      100 |      100 |      100 |      100 |                |
  SafeMath.sol                 |      100 |      100 |      100 |      100 |                |
  UpgradeabilityProxy.sol      |    71.43 |       50 |       75 |    77.78 |          52,53 |
-------------------------------|----------|----------|----------|----------|----------------|
All files                      |    95.38 |    86.11 |    91.23 |     95.7 |                |
-------------------------------|----------|----------|----------|----------|----------------|

> Istanbul reports written to ./coverage/ and ./coverage.json
> solidity-coverage cleaning up, shutting down ganache server