Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from pjsimpkins/openzeppelin_upgrade
OpenZeppelin SDK Upgrade
- Loading branch information
Showing
8 changed files
with
5,503 additions
and
228 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
build/ | ||
.openzeppelin | ||
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module.exports = { | ||
networks: { | ||
development: { | ||
protocol: 'http', | ||
host: 'localhost', | ||
port: 8545, | ||
gas: 5000000, | ||
gasPrice: 5e9, | ||
networkId: '*', | ||
}, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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" | ||
} | ||
} |
Oops, something went wrong.