Skip to content

Commit

Permalink
Merge pull request #1 from pjsimpkins/openzeppelin_upgrade
Browse files Browse the repository at this point in the history
OpenZeppelin SDK Upgrade
  • Loading branch information
ogarci5 committed Oct 1, 2020
2 parents 1ca1cc8 + e0ed739 commit 6245712
Show file tree
Hide file tree
Showing 8 changed files with 5,503 additions and 228 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
build/
.openzeppelin
node_modules/
52 changes: 50 additions & 2 deletions README.md
@@ -1,2 +1,50 @@
# ArroERC20Code
Arro Code for Solidity
# Arro Token Contract
This repo contains the solidity contract code for the Arro.io (ARRO) ERC20 Token.
It uses OpenZeppelin SDK to create an upgradeable ERC20 Token contract.

### Installation
Install `yarn` and install dependencies
```
yarn install
```

### Development
Use a development blockchain to test the deployment of the smart contract.
In another tab / window run:
```
npx ganache-cli --deterministic
```

Take note of the accounts created.

Then compile and deploy
```
npx oz compile
npx oz deploy
```

When deploying run the `initialize()` function with the expected owner.

To test instance methods on the contract use
```
npx oz call
```
Example:
```
? Pick a network development
? Pick an instance ArroToken at 0xA57B8a5584442B467b4689F1144D269d096A3daF
? Select which function owner()
✓ Method 'owner()' returned: 0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0
0xFFcf8FDEE72ac11b5c542428B35EEF5769C409f0
```

To test transactions similarly use
```
npx oz send-tx
```
Use the flag `-f` to specific `from` to test a transaction

### Testing
TDB

Any questions reach out to `robinhood@arro.io`
226 changes: 0 additions & 226 deletions Solidity

This file was deleted.

Empty file added contracts/.gitkeep
Empty file.
65 changes: 65 additions & 0 deletions contracts/ArroToken.sol
@@ -0,0 +1,65 @@
// SPDX-License-Identifier: MIT
/**
* Source Code first verified at https://etherscan.io on Monday, July 30, 2018
(UTC) */

pragma solidity ^0.6.2;

// ----------------------------------------------------------------------------
// 'ARRO' token contract
//
// Deployed to :
// Symbol : ARRO
// Name : Arro.io
// Total supply: 30,000,000,000
// Decimals : 18
//
//
//
// ----------------------------------------------------------------------------

import "@openzeppelin/contracts-ethereum-package/contracts/GSN/Context.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/access/Ownable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/token/ERC20/ERC20Pausable.sol";
import "@openzeppelin/contracts-ethereum-package/contracts/Initializable.sol";

contract ArroToken is Initializable, ContextUpgradeSafe, OwnableUpgradeSafe, ERC20PausableUpgradeSafe {

// ------------------------------------------------------------------------
// Gives Owner all tokens
// ------------------------------------------------------------------------
function initialize(address owner) public {
__Context_init_unchained();
__Ownable_init_unchained();
__ERC20_init_unchained("Arro.io", "ARRO");
__Pausable_init_unchained();
__ERC20Pausable_init_unchained();

_mint(owner, 30000000000 * (10 ** uint256(decimals())));
transferOwnership(owner);
}

// ------------------------------------------------------------------------
// Owner can transfer out any accidentally sent ERC20 tokens
// ------------------------------------------------------------------------
function transferAnyERC20Token(address tokenAddress, uint amount) public onlyOwner returns (bool) {
_transfer(tokenAddress, owner(), amount);
return true;
}

// ------------------------------------------------------------------------
// Owner can pause all transfers
// ------------------------------------------------------------------------
function pause() public onlyOwner {
_pause();
}

// ------------------------------------------------------------------------
// Owner can unpause all transfers
// ------------------------------------------------------------------------
function unpause() public onlyOwner {
_unpause();
}

}
12 changes: 12 additions & 0 deletions networks.js
@@ -0,0 +1,12 @@
module.exports = {
networks: {
development: {
protocol: 'http',
host: 'localhost',
port: 8545,
gas: 5000000,
gasPrice: 5e9,
networkId: '*',
},
},
};
10 changes: 10 additions & 0 deletions package.json
@@ -0,0 +1,10 @@
{
"dependencies": {
"@openzeppelin/cli": "^2.8.2",
"@openzeppelin/contracts": "^3.2.0",
"@openzeppelin/contracts-ethereum-package": "^3.0.0",
"@openzeppelin/upgrades": "^2.8.0",
"ganache-cli": "^6.11.0",
"solc": "0.6.2"
}
}

0 comments on commit 6245712

Please sign in to comment.