Compare commits

...

14 Commits

Author SHA1 Message Date
Bogdan-Ștefan Neacșu b22f804ed8 Use nymt field 2022-02-11 14:18:10 +00:00
Max Hampshire 6b18493ece updated script for nymt 2022-02-11 14:22:31 +01:00
mfahampshire aa56e388ce added missed step in rinkeby runthrough on readme 2022-02-04 18:29:51 +01:00
mfahampshire 48e82b32b6 updated readme with WIP rinkeby commands 2022-02-04 18:11:21 +01:00
mfahampshire ec67c12978 *tidied up contract addresses file,
*created mainnet generation script
*created mainnet bandwidth generator deploy script for NYMT
2022-02-04 17:40:37 +01:00
mfahampshire bd27d24e6a scripted runthrough for rinkeby 2022-02-04 17:36:00 +01:00
mfahampshire 1622286ee3 removed old address 2022-02-04 17:16:25 +01:00
mfahampshire 9c7c489e3a tidyup after debug 2022-02-04 17:15:47 +01:00
mfahampshire 19a2629391 reintroduced sig length check 2022-02-04 16:36:54 +01:00
mfahampshire fd3ea27dbc bug hunting with maths in bandwidth contract 2022-02-04 16:36:44 +01:00
mfahampshire 79c62aca27 deployed bandwidth with no gravity for gas difference check 2022-02-03 18:35:42 +01:00
mfahampshire e47044e0a9 tidyup code comments 2022-02-03 16:17:26 +01:00
mfahampshire 3cfdb56f5d added version of bandwidth generator which doesn't interact with Gravity Bridge 2022-02-03 16:10:28 +01:00
mfahampshire 55762b52b9 added gas coverage tool 2022-02-03 15:15:02 +01:00
22 changed files with 959 additions and 72 deletions
+27 -1
View File
@@ -9,9 +9,35 @@ BBCs are credentials that will be presented to Gateways by a Nym Client, and rep
By default 1 NYM = 1 GB of bandwidth. The ratio of NYM - bandwidth is denominated in bytes, and represented in the smart contract by the `BytesPerToken` variable. This variable can be adjusted by the contract owner.
The amount of bandwidth bought is calculated according to the following formula:
`(Token amount in 'wei' * BytesPerToken) / 10**18`
`(Token amount in 'wei' * BytesPerToken) / 10**6`
This maths relies on the fact that the `CosmosERC20` token deployed by the Gravity contract has 6 decimals (instead of the standard 18), to keep balances mirrored with Cosmos.
## Usage
### Basic usage
* `npm install`
* `npx hardhat compile`
* `npx hardhat test`
### Generate a credential on rinkeby testnet:
```
# deploy Test Gravity contract, which has extra mint function for ease of testing
npx hardhat run scripts/rinkeby/deploy-test-gravity.js --network rinkeby
(TODO script following 4 commands)
# verify Gravity contract on etherscan - remember to change the values in the `gravity-args` file
npx hardhat verify --constructor-args ./scripts/rinkeby/gravity-args.js --network rinkeby CONTRACT_ADDRESS
# Create a token on Gravity etherscan interface with `deployERC20()` - remember to fill in the deployed contract address in `./contractAddresses.json`
# verify token contract
# mint yourself some tokens
# `approve()` bandwidth generator contract with amount of tokens you want to send. Remember this token has ONLY 6 DECIMALS, not 18 as is usual with Eth tokens
# deploy the bandwidthGenerator contract:
npx hardhat run scripts/rinkeby/deploy-bandwidth-generator.js --network rinkeby
# Run the script
npx hardhat run scripts/rinkeby/generate-bandwidth-credential.js --network rinkeby
# Check etherscan address in the console output for event logs.
```
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../../build-info/1f95016aa87f8376998977fedfcae017.json"
"buildInfo": "../../../../../build-info/2d51c1ee73b60d3841c3aaecda52bf9b.json"
}
File diff suppressed because one or more lines are too long
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../../build-info/1f95016aa87f8376998977fedfcae017.json"
"buildInfo": "../../../../../build-info/2d51c1ee73b60d3841c3aaecda52bf9b.json"
}
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../../../build-info/1f95016aa87f8376998977fedfcae017.json"
"buildInfo": "../../../../../../build-info/2d51c1ee73b60d3841c3aaecda52bf9b.json"
}
@@ -1,4 +1,4 @@
{
"_format": "hh-sol-dbg-1",
"buildInfo": "../../../../build-info/1f95016aa87f8376998977fedfcae017.json"
"buildInfo": "../../../../build-info/2d51c1ee73b60d3841c3aaecda52bf9b.json"
}
@@ -2,8 +2,8 @@
"_format": "hh-sol-cache-2",
"files": {
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol": {
"lastModificationDate": 1643129770695,
"contentHash": "642b72e2d50d565db7bc994cace3f5a0",
"lastModificationDate": 1643991031913,
"contentHash": "74194be7556a5b0ffe27ab54ae7da410",
"sourceName": "contracts/BandwidthGenerator.sol",
"solcConfig": {
"version": "0.8.10",
@@ -41,7 +41,7 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/CosmosToken.sol": {
"lastModificationDate": 1642773899716,
"lastModificationDate": 1643627584895,
"contentHash": "fc5dd09fe73bc6cfece970f702a3aba1",
"sourceName": "contracts/CosmosToken.sol",
"solcConfig": {
@@ -77,7 +77,7 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/Gravity.sol": {
"lastModificationDate": 1642773899716,
"lastModificationDate": 1643627584895,
"contentHash": "0d6dae561f7b541bafb892b8593a08ac",
"sourceName": "contracts/Gravity.sol",
"solcConfig": {
@@ -118,8 +118,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/access/Ownable.sol": {
"lastModificationDate": 1641812554274,
"contentHash": "4fe56b59ced59d87df6b796758f62895",
"lastModificationDate": 1643896343014,
"contentHash": "8398972af73b4e9e5ff3b31cad86234f",
"sourceName": "@openzeppelin/contracts/access/Ownable.sol",
"solcConfig": {
"version": "0.8.10",
@@ -154,8 +154,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol": {
"lastModificationDate": 1641812554378,
"contentHash": "5365090efc586b728719e562ebfed0d6",
"lastModificationDate": 1643896343082,
"contentHash": "a6a9d6c1f662e922b82c1ba4d81cdd48",
"sourceName": "@openzeppelin/contracts/utils/math/SafeMath.sol",
"solcConfig": {
"version": "0.8.10",
@@ -188,8 +188,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol": {
"lastModificationDate": 1641812553614,
"contentHash": "2cd550cedf51b8d294607dad5023d717",
"lastModificationDate": 1643896342638,
"contentHash": "f48de0eaae9544072b8766e2eac528a7",
"sourceName": "@openzeppelin/contracts/token/ERC20/ERC20.sol",
"solcConfig": {
"version": "0.8.10",
@@ -226,8 +226,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol": {
"lastModificationDate": 1641812554110,
"contentHash": "0eac3e1a83ee62326ca007811285b274",
"lastModificationDate": 1643896342950,
"contentHash": "302d9755e46bc69d7058b0cbe7185e37",
"sourceName": "@openzeppelin/contracts/token/ERC20/IERC20.sol",
"solcConfig": {
"version": "0.8.10",
@@ -260,8 +260,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
"lastModificationDate": 1641812554118,
"contentHash": "aa1be06992a99bb7393b26a6af3c4dfb",
"lastModificationDate": 1643896342950,
"contentHash": "909ab67fc5c25033fe6cd364f8c056f9",
"sourceName": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol",
"solcConfig": {
"version": "0.8.10",
@@ -296,8 +296,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/Context.sol": {
"lastModificationDate": 1641812553346,
"contentHash": "851485d5b925529b1a2f34a0be077891",
"lastModificationDate": 1643896342562,
"contentHash": "5f2c5c4b6af2dd4551027144797bc8be",
"sourceName": "@openzeppelin/contracts/utils/Context.sol",
"solcConfig": {
"version": "0.8.10",
@@ -330,8 +330,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": {
"lastModificationDate": 1641812554370,
"contentHash": "d37406082a74a9b6b114de522fcb6349",
"lastModificationDate": 1643896343082,
"contentHash": "76814c83c32552ed2b521c816b4d801a",
"sourceName": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol",
"solcConfig": {
"version": "0.8.10",
@@ -367,8 +367,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol": {
"lastModificationDate": 1641812554322,
"contentHash": "53fbff678f378956efcb207fa748eaa6",
"lastModificationDate": 1643896343066,
"contentHash": "92f9448b23a90ea3bb932ee55cc3ccce",
"sourceName": "@openzeppelin/contracts/security/ReentrancyGuard.sol",
"solcConfig": {
"version": "0.8.10",
@@ -401,8 +401,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/Address.sol": {
"lastModificationDate": 1641812553270,
"contentHash": "c5f6c4e4df069c789e7d84b4c3011913",
"lastModificationDate": 1643896342558,
"contentHash": "4cff8b2ea0d958750786b4e3ca308445",
"sourceName": "@openzeppelin/contracts/utils/Address.sol",
"solcConfig": {
"version": "0.8.10",
@@ -435,8 +435,8 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol": {
"lastModificationDate": 1641812553414,
"contentHash": "197dbfaf7146845fa76331a4c9980e9f",
"lastModificationDate": 1643896342586,
"contentHash": "395edffd6bb2b3ba29970d5814039654",
"sourceName": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol",
"solcConfig": {
"version": "0.8.10",
@@ -460,7 +460,9 @@
}
}
},
"imports": [],
"imports": [
"../Strings.sol"
],
"versionPragmas": [
"^0.8.0"
],
@@ -469,7 +471,7 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/test-contracts/TestCosmosToken.sol": {
"lastModificationDate": 1642773899716,
"lastModificationDate": 1643627584895,
"contentHash": "957b6079ee0d5a6e048fce8555c14dee",
"sourceName": "contracts/test-contracts/TestCosmosToken.sol",
"solcConfig": {
@@ -505,7 +507,7 @@
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol": {
"lastModificationDate": 1642773899716,
"lastModificationDate": 1643627584895,
"contentHash": "f24299c3acb20aff23914e16b7ba95e1",
"sourceName": "contracts/test-contracts/TestGravity.sol",
"solcConfig": {
@@ -544,6 +546,113 @@
"artifacts": [
"TestGravity"
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/Strings.sol": {
"lastModificationDate": 1643896343114,
"contentHash": "9c54c6c065d9e590fdcdd72c451425b9",
"sourceName": "@openzeppelin/contracts/utils/Strings.sol",
"solcConfig": {
"version": "0.8.10",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
"^0.8.0"
],
"artifacts": [
"Strings"
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/hardhat/console.sol": {
"lastModificationDate": 1641812555138,
"contentHash": "cc4777addd464ea56fa35b1c45df0591",
"sourceName": "hardhat/console.sol",
"solcConfig": {
"version": "0.8.10",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers"
],
"": [
"ast"
]
}
}
}
},
"imports": [],
"versionPragmas": [
">=0.4.22 <0.9.0"
],
"artifacts": [
"console"
]
},
"/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/debug/BandwidthGeneratorNoGravity.sol": {
"lastModificationDate": 1643991077561,
"contentHash": "bd97e288bf24ad18aa0cefbefd71ea15",
"sourceName": "contracts/debug/BandwidthGeneratorNoGravity.sol",
"solcConfig": {
"version": "0.8.10",
"settings": {
"optimizer": {
"enabled": true,
"runs": 200
},
"outputSelection": {
"*": {
"*": [
"abi",
"evm.bytecode",
"evm.deployedBytecode",
"evm.methodIdentifiers"
],
"": [
"ast"
]
}
}
}
},
"imports": [
"../CosmosToken.sol",
"@openzeppelin/contracts/access/Ownable.sol",
"@openzeppelin/contracts/utils/math/SafeMath.sol",
"hardhat/console.sol"
],
"versionPragmas": [
"0.8.10"
],
"artifacts": [
"BandwidthGeneratorNoGravity"
]
}
}
}
@@ -1,14 +1,12 @@
{
"rinkeby":{
"NYM_ERC20":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B",
"BANDWIDTH_GENERATOR":"0x5FbDB2315678afecb367f032d93F642f64180aa3",
"GRAVITY":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B"
},
"mainnet":{
"NYM_ERC20":"0x525A8F6F3Ba4752868cde25164382BfbaE3990e1",
"NYMT": "0xE8883BAeF3869e14E4823F46662e81D4F7d2A81F",
"BANDWIDTH_GENERATOR":"",
"BANDWIDTH_GENERATOR_NYMT":"0xB3BF30DD53044c9050B7309031Bbf26b2cecF3be",
"GRAVITY":"0xa4108aA1Ec4967F8b52220a4f7e94A8201F2D906"
}
}
{"rinkeby":{
"NYM_ERC20":"0x1f0e8a26f223483b8307a65c37dae0322eb04720",
"BANDWIDTH_GENERATOR":"0xd9006A128B4daC3E15769a7fd36Cc1A1192844Ce",
"GRAVITY":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B",
"TEST_GRAVITY":"0x8383D4741e926549c9B42938B512A0fbF6Ccc8A0"
},"mainnet":{
"NYM_ERC20":"0x525A8F6F3Ba4752868cde25164382BfbaE3990e1",
"NYMT":"0xE8883BAeF3869e14E4823F46662e81D4F7d2A81F",
"BANDWIDTH_GENERATOR":"",
"BANDWIDTH_GENERATOR_NYMT":"0xB3BF30DD53044c9050B7309031Bbf26b2cecF3be",
"GRAVITY":"0xa4108aA1Ec4967F8b52220a4f7e94A8201F2D906"
}}
@@ -16,7 +16,7 @@ import "@openzeppelin/contracts/utils/math/SafeMath.sol";
* Credentials represent a certain amount of bandwidth which can be sent through the Nym Mixnet.
* By default 1 NYM = 1 GB of bandwidth. The `BytesPerToken` amount can be adjusted by the contract owner.
* The amount of bandwidth bought is calculated according to the following formula:
* `(Token amount in 'wei' / 10**18) * BytesPerToken`
* `(Token amount in 'wei' / 10**6) * BytesPerToken`
*/
contract BandwidthGenerator is Ownable {
@@ -107,7 +107,7 @@ contract BandwidthGenerator is Ownable {
function bandwidthFromToken(uint256 _amount) public view returns (uint256) {
uint256 amountMulBytes = _amount.mul(BytesPerToken);
return amountMulBytes.div(10**18);
return amountMulBytes.div(10**6);
}
}
@@ -0,0 +1,109 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity 0.8.10;
import "../CosmosToken.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "@openzeppelin/contracts/utils/math/SafeMath.sol";
import "hardhat/console.sol";
/**
* @title BandwidthGenerator
* @dev Contract for generating Basic Bandwidth Credentials (BBCs) on the Nym cosmos blockchain,
* using ERC20 representations of NYM as payment.
*
* Credential generation can be switched on/off by the contract owner.
*
* Credentials represent a certain amount of bandwidth which can be sent through the Nym Mixnet.
* By default 1 NYM = 1 GB of bandwidth. The `BytesPerToken` amount can be adjusted by the contract owner.
* The amount of bandwidth bought is calculated according to the following formula:
* `(Token amount in 'wei' / 10**18) * BytesPerToken`
*/
contract BandwidthGeneratorNoGravity is Ownable {
using SafeMath for uint256;
CosmosERC20 public erc20;
uint256 public BytesPerToken;
bool public credentialGenerationEnabled;
event BBCredentialPurchased(
uint256 Bandwidth,
uint256 indexed VerificationKey,
bytes SignedVerificationKey,
string CosmosRecipient
);
event RatioChanged(
uint256 indexed NewBytesPerToken
);
event CredentialGenerationSwitch(
bool Enabled
);
modifier checkEnabled() {
require(credentialGenerationEnabled, "BandwidthGenerator: credential generation isn't currently enabled");
_;
}
/**
* @param _erc20 Address of the erc20NYM deployed through the Gravity Bridge.
*/
constructor(CosmosERC20 _erc20) {
require(address(_erc20) != address(0), "BandwidthGenerator: erc20 address cannot be null");
erc20 = _erc20;
BytesPerToken = 1073741824; // default amount set at deployment: 1 erc20NYM = 1073741824 Bytes = 1GB
credentialGenerationEnabled = true;
}
/**
* @dev Changes amount of Bytes each erc20NYM is tradable for. Can only be called by Owner.
* @param _newBytesPerTokenAmount Amount of Bytes BBC is worth per 1 erc20NYM token.
*/
function changeRatio(uint256 _newBytesPerTokenAmount) public onlyOwner {
require(_newBytesPerTokenAmount != 0, "BandwidthGenerator: price cannot be 0");
BytesPerToken = _newBytesPerTokenAmount;
emit RatioChanged(_newBytesPerTokenAmount);
}
/**
* @dev Switches credential generation on/off. Can only be called by Owner.
* @param _generation Whether credential generation is turned on/off.
*/
function credentialGenerationSwitch(bool _generation) public onlyOwner {
credentialGenerationEnabled = _generation;
emit CredentialGenerationSwitch(_generation);
}
/**
* @dev Function to create a BBC for account owning the verification key on the Nym Cosmos Blockchain
* by transfering erc20NYM via the Gravity Bridge.
* @param _amount Amount of erc20NYM tokens to spend on BBC - denominated in wei.
* @param _verificationKey Verification key of account on Nym blockchain who is purchasing BBC.
* @param _signedVerificationKey Number of erc20NYMs to spend signed by _verificationKey for auth on Cosmos Blockchain.
* @param _cosmosRecipient Address of the recipient of payment on Nym Cosmos Blockchain.
*/
function generateBasicBandwidthCredential(uint256 _amount, uint256 _verificationKey, bytes memory _signedVerificationKey, string calldata _cosmosRecipient) public checkEnabled {
// temporarily removed this check
// require(_signedVerificationKey.length == 64, "BandwidthGenerator: Signature doesn't have 64 bytes");
erc20.transferFrom(msg.sender, address(this), _amount);
console.log(_amount);
uint256 bandwidth = bandwidthFromToken(_amount);
console.log(bandwidth);
emit BBCredentialPurchased(
bandwidth,
_verificationKey,
_signedVerificationKey,
_cosmosRecipient
);
}
function bandwidthFromToken(uint256 _amount) public view returns (uint256) {
uint256 amountMulBytes = _amount.mul(BytesPerToken);
// return amountMulBytes.div(10**18);
return amountMulBytes.div(10**6);
}
}
@@ -2,6 +2,7 @@ require("@nomiclabs/hardhat-etherscan");
require("@nomiclabs/hardhat-truffle5");
require("@nomiclabs/hardhat-web3");
require("@nomiclabs/hardhat-ethers");
require("hardhat-gas-reporter");
require('dotenv').config({ path: require('find-config')('.env') });
/**
@@ -18,6 +19,10 @@ module.exports = {
// paths: {
// artifacts: "./artifacts/contracts"
// },
gasReporter: {
currency: 'EUR',
gasPrice: 78
},
networks: {
localhost: {
url: "http://127.0.0.1:8545"
+468 -1
View File
@@ -3438,6 +3438,24 @@
"resolved": "https://registry.npmjs.org/@types/chai/-/chai-4.2.22.tgz",
"integrity": "sha512-tFfcE+DSTzWAgifkjik9AySNqIyNoYwmR+uecPwwD/XRNfvOjmC/FjCxpiUGDkDVDphPfCUecSQVFw+lN3M3kQ=="
},
"@types/concat-stream": {
"version": "1.6.1",
"resolved": "https://registry.npmjs.org/@types/concat-stream/-/concat-stream-1.6.1.tgz",
"integrity": "sha512-eHE4cQPoj6ngxBZMvVf6Hw7Mh4jMW4U9lpGmS5GBPB9RYxlFg+CHaVN7ErNY4W9XfLIEn20b4VDYaIrbq0q4uA==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/form-data": {
"version": "0.0.33",
"resolved": "https://registry.npmjs.org/@types/form-data/-/form-data-0.0.33.tgz",
"integrity": "sha1-yayFsqX9GENbjIXZ7LUObWyJP/g=",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"@types/glob": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.4.tgz",
@@ -3515,6 +3533,12 @@
"integrity": "sha512-eI5Yrz3Qv4KPUa/nSIAi0h+qX0XyewOliug5F2QAtuRg6Kjg6jfmxe1GIwoIRhZspD1A0RP8ANrPwvEXXtRFog==",
"dev": true
},
"@types/qs": {
"version": "6.9.7",
"resolved": "https://registry.npmjs.org/@types/qs/-/qs-6.9.7.tgz",
"integrity": "sha512-FGa1F62FT09qcrueBA6qYTrJPVDzah9a+493+o2PCXsesWHIn27G98TsSMs3WPNbZIEj4+VJf6saSFpvD+3Zsw==",
"dev": true
},
"@types/resolve": {
"version": "0.0.8",
"resolved": "https://registry.npmjs.org/@types/resolve/-/resolve-0.0.8.tgz",
@@ -3817,6 +3841,12 @@
"integrity": "sha1-qJS3XUvE9s1nnvMkSp/Y9Gri1Cg=",
"optional": true
},
"asap": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz",
"integrity": "sha1-5QNHYR1+aQlDIIu9r+vLwvuGbUY=",
"dev": true
},
"asn1": {
"version": "0.2.4",
"resolved": "https://registry.npmjs.org/asn1/-/asn1-0.2.4.tgz",
@@ -4043,6 +4073,23 @@
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.2.0.tgz",
"integrity": "sha512-jDctJ/IVQbZoJykoeHbhXpOlNBqGNcwXJKJog42E5HDPUwQTSdjCHdihjj0DlnheQ7blbT6dHOafNAiS8ooQKA=="
},
"bindings": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz",
"integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==",
"requires": {
"file-uri-to-path": "1.0.0"
}
},
"bip66": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/bip66/-/bip66-1.1.5.tgz",
"integrity": "sha1-AfqHSHhcpwlV1QESF9GzE5lpyiI=",
"dev": true,
"requires": {
"safe-buffer": "^5.0.1"
}
},
"blakejs": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/blakejs/-/blakejs-1.1.1.tgz",
@@ -4475,6 +4522,12 @@
"upper-case-first": "^1.1.0"
}
},
"charenc": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/charenc/-/charenc-0.0.2.tgz",
"integrity": "sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc=",
"dev": true
},
"check-error": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.2.tgz",
@@ -4599,6 +4652,17 @@
}
}
},
"cli-table3": {
"version": "0.5.1",
"resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.5.1.tgz",
"integrity": "sha512-7Qg2Jrep1S/+Q3EceiZtQcDPWxhAvBw+ERf1162v4sikJrvojMHFqXt8QIVha8UlH9rgU0BeWPytZ9/TzYqlUw==",
"dev": true,
"requires": {
"colors": "^1.1.2",
"object-assign": "^4.1.0",
"string-width": "^2.1.1"
}
},
"cliui": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-5.0.0.tgz",
@@ -4721,6 +4785,50 @@
"resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
"integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
},
"concat-stream": {
"version": "1.6.2",
"resolved": "https://registry.npmjs.org/concat-stream/-/concat-stream-1.6.2.tgz",
"integrity": "sha512-27HBghJxjiZtIk3Ycvn/4kbJk/1uZuJFfuPEns6LaEvpvG1f0hTea8lilrouyo9mVc2GWdcEZ8OLoGmSADlrCw==",
"dev": true,
"requires": {
"buffer-from": "^1.0.0",
"inherits": "^2.0.3",
"readable-stream": "^2.2.2",
"typedarray": "^0.0.6"
},
"dependencies": {
"readable-stream": {
"version": "2.3.7",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.3.7.tgz",
"integrity": "sha512-Ebho8K4jIbHAxnuxi7o42OrZgF/ZTNcsZj6nRKyUmkhLFq8CHItp/fy6hQZuZmP/n3yZ9VBUbp4zz/mX8hmYPw==",
"dev": true,
"requires": {
"core-util-is": "~1.0.0",
"inherits": "~2.0.3",
"isarray": "~1.0.0",
"process-nextick-args": "~2.0.0",
"safe-buffer": "~5.1.1",
"string_decoder": "~1.1.1",
"util-deprecate": "~1.0.1"
}
},
"safe-buffer": {
"version": "5.1.2",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.1.2.tgz",
"integrity": "sha512-Gd2UZBJDkXlY7GbJxfsE8/nvKkUEU1G38c1siN6QP6a9PT9MmHB8GnpscSmMJSoF8LOIrt8ud/wPtojys4G6+g==",
"dev": true
},
"string_decoder": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
"integrity": "sha512-n/ShnvDi6FHbbVfviro+WojiFzv+s8MPMHBczVePfUpDJLwoLT0ht1l4YwBCbi8pJAveEEdnkHyPyTP/mzRfwg==",
"dev": true,
"requires": {
"safe-buffer": "~5.1.0"
}
}
}
},
"console-browserify": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.2.0.tgz",
@@ -4876,6 +4984,12 @@
}
}
},
"crypt": {
"version": "0.0.2",
"resolved": "https://registry.npmjs.org/crypt/-/crypt-0.0.2.tgz",
"integrity": "sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs=",
"dev": true
},
"crypto-addr-codec": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/crypto-addr-codec/-/crypto-addr-codec-0.1.7.tgz",
@@ -5217,6 +5331,17 @@
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-10.0.0.tgz",
"integrity": "sha512-rlBi9d8jpv9Sf1klPjNfFAuWDjKLwTIJJ/VxtoTwIR6hnZxcEOQCZg2oIL3MWBYw5GpUDKOEnND7LXTbIpQ03Q=="
},
"drbg.js": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/drbg.js/-/drbg.js-1.0.1.tgz",
"integrity": "sha1-Pja2xCs3BDgjzbwzLVjzHiRFSAs=",
"dev": true,
"requires": {
"browserify-aes": "^1.0.6",
"create-hash": "^1.1.2",
"create-hmac": "^1.1.4"
}
},
"duplexer3": {
"version": "0.1.4",
"resolved": "https://registry.npmjs.org/duplexer3/-/duplexer3-0.1.4.tgz",
@@ -5563,6 +5688,137 @@
"js-sha3": "^0.5.7"
}
},
"eth-gas-reporter": {
"version": "0.2.24",
"resolved": "https://registry.npmjs.org/eth-gas-reporter/-/eth-gas-reporter-0.2.24.tgz",
"integrity": "sha512-RbXLC2bnuPHzIMU/rnLXXlb6oiHEEKu7rq2UrAX/0mfo0Lzrr/kb9QTjWjfz8eNvc+uu6J8AuBwI++b+MLNI2w==",
"dev": true,
"requires": {
"@ethersproject/abi": "^5.0.0-beta.146",
"@solidity-parser/parser": "^0.14.0",
"cli-table3": "^0.5.0",
"colors": "1.4.0",
"ethereumjs-util": "6.2.0",
"ethers": "^4.0.40",
"fs-readdir-recursive": "^1.1.0",
"lodash": "^4.17.14",
"markdown-table": "^1.1.3",
"mocha": "^7.1.1",
"req-cwd": "^2.0.0",
"request": "^2.88.0",
"request-promise-native": "^1.0.5",
"sha1": "^1.1.1",
"sync-request": "^6.0.0"
},
"dependencies": {
"@solidity-parser/parser": {
"version": "0.14.0",
"resolved": "https://registry.npmjs.org/@solidity-parser/parser/-/parser-0.14.0.tgz",
"integrity": "sha512-cX0JJRcmPtNUJpzD2K7FdA7qQsTOk1UZnFx2k7qAg9ZRvuaH5NBe5IEdBMXGlmf2+FmjhqbygJ26H8l2SV7aKQ==",
"dev": true,
"requires": {
"antlr4ts": "^0.5.0-alpha.4"
}
},
"@types/bn.js": {
"version": "4.11.6",
"resolved": "https://registry.npmjs.org/@types/bn.js/-/bn.js-4.11.6.tgz",
"integrity": "sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==",
"dev": true,
"requires": {
"@types/node": "*"
}
},
"ethereumjs-util": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/ethereumjs-util/-/ethereumjs-util-6.2.0.tgz",
"integrity": "sha512-vb0XN9J2QGdZGIEKG2vXM+kUdEivUfU6Wmi5y0cg+LRhDYKnXIZ/Lz7XjFbHRR9VIKq2lVGLzGBkA++y2nOdOQ==",
"dev": true,
"requires": {
"@types/bn.js": "^4.11.3",
"bn.js": "^4.11.0",
"create-hash": "^1.1.2",
"ethjs-util": "0.1.6",
"keccak": "^2.0.0",
"rlp": "^2.2.3",
"secp256k1": "^3.0.1"
}
},
"ethers": {
"version": "4.0.49",
"resolved": "https://registry.npmjs.org/ethers/-/ethers-4.0.49.tgz",
"integrity": "sha512-kPltTvWiyu+OktYy1IStSO16i2e7cS9D9OxZ81q2UUaiNPVrm/RTcbxamCXF9VUSKzJIdJV68EAIhTEVBalRWg==",
"dev": true,
"requires": {
"aes-js": "3.0.0",
"bn.js": "^4.11.9",
"elliptic": "6.5.4",
"hash.js": "1.1.3",
"js-sha3": "0.5.7",
"scrypt-js": "2.0.4",
"setimmediate": "1.0.4",
"uuid": "2.0.1",
"xmlhttprequest": "1.8.0"
}
},
"hash.js": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.3.tgz",
"integrity": "sha512-/UETyP0W22QILqS+6HowevwhEFJ3MBJnwTf75Qob9Wz9t0DPuisL8kW8YZMK62dHAKE1c1p+gY1TtOLY+USEHA==",
"dev": true,
"requires": {
"inherits": "^2.0.3",
"minimalistic-assert": "^1.0.0"
}
},
"keccak": {
"version": "2.1.0",
"resolved": "https://registry.npmjs.org/keccak/-/keccak-2.1.0.tgz",
"integrity": "sha512-m1wbJRTo+gWbctZWay9i26v5fFnYkOn7D5PCxJ3fZUGUEb49dE1Pm4BREUYCt/aoO6di7jeoGmhvqN9Nzylm3Q==",
"dev": true,
"requires": {
"bindings": "^1.5.0",
"inherits": "^2.0.4",
"nan": "^2.14.0",
"safe-buffer": "^5.2.0"
}
},
"scrypt-js": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-2.0.4.tgz",
"integrity": "sha512-4KsaGcPnuhtCZQCxFxN3GVYIhKFPTdLd8PLC552XwbMndtD0cjRFAhDuuydXQ0h08ZfPgzqe6EKHozpuH74iDw==",
"dev": true
},
"secp256k1": {
"version": "3.8.0",
"resolved": "https://registry.npmjs.org/secp256k1/-/secp256k1-3.8.0.tgz",
"integrity": "sha512-k5ke5avRZbtl9Tqx/SA7CbY3NF6Ro+Sj9cZxezFzuBlLDmyqPiL8hJJ+EmzD8Ig4LUDByHJ3/iPOVoRixs/hmw==",
"dev": true,
"requires": {
"bindings": "^1.5.0",
"bip66": "^1.1.5",
"bn.js": "^4.11.8",
"create-hash": "^1.2.0",
"drbg.js": "^1.0.1",
"elliptic": "^6.5.2",
"nan": "^2.14.0",
"safe-buffer": "^5.1.2"
}
},
"setimmediate": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/setimmediate/-/setimmediate-1.0.4.tgz",
"integrity": "sha1-IOgd5iLUoCWIzgyNqJc8vPHTE48=",
"dev": true
},
"uuid": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-2.0.1.tgz",
"integrity": "sha1-wqMN7bPlNdcsz4LjQ5QaULqFM6w=",
"dev": true
}
}
},
"eth-lib": {
"version": "0.2.8",
"resolved": "https://registry.npmjs.org/eth-lib/-/eth-lib-0.2.8.tgz",
@@ -6431,6 +6687,11 @@
"utils-extend": "^1.0.4"
}
},
"file-uri-to-path": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz",
"integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw=="
},
"fill-range": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz",
@@ -6608,6 +6869,12 @@
"minipass": "^2.6.0"
}
},
"fs-readdir-recursive": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/fs-readdir-recursive/-/fs-readdir-recursive-1.1.0.tgz",
"integrity": "sha512-GNanXlVr2pf02+sPN40XN8HG+ePaNcvM0q5mZBd668Obwb0yD5GiUbZOFgwn8kGMY6I3mdyDJzieUy3PTYyTRA==",
"dev": true
},
"fs.realpath": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
@@ -16199,6 +16466,12 @@
"has-symbols": "^1.0.1"
}
},
"get-port": {
"version": "3.2.0",
"resolved": "https://registry.npmjs.org/get-port/-/get-port-3.2.0.tgz",
"integrity": "sha1-3Xzn3hh8Bsi/NTeWrHHgmfCYDrw=",
"dev": true
},
"get-stream": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/get-stream/-/get-stream-4.1.0.tgz",
@@ -16417,6 +16690,17 @@
"ws": "^7.4.6"
}
},
"hardhat-gas-reporter": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/hardhat-gas-reporter/-/hardhat-gas-reporter-1.0.7.tgz",
"integrity": "sha512-calJH1rbhUFwCnw0odJb3Cw+mDmBIsHdVyutsHhA3RY6JELyFVaVxCnITYGr/crkmHqt4tQCYROy7ty6DTLkuA==",
"dev": true,
"requires": {
"array-uniq": "1.0.3",
"eth-gas-reporter": "^0.2.24",
"sha1": "^1.1.1"
}
},
"has": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz",
@@ -16588,6 +16872,18 @@
"entities": "^2.0.0"
}
},
"http-basic": {
"version": "8.1.3",
"resolved": "https://registry.npmjs.org/http-basic/-/http-basic-8.1.3.tgz",
"integrity": "sha512-/EcDMwJZh3mABI2NhGfHOGOeOZITqfkEO4p/xK+l3NpyncIHUQBoMvCSF/b5GqvKtySC2srL/GGG3+EtlqlmCw==",
"dev": true,
"requires": {
"caseless": "^0.12.0",
"concat-stream": "^1.6.2",
"http-response-object": "^3.0.1",
"parse-cache-control": "^1.0.1"
}
},
"http-cache-semantics": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/http-cache-semantics/-/http-cache-semantics-4.1.0.tgz",
@@ -16610,6 +16906,23 @@
"resolved": "https://registry.npmjs.org/http-https/-/http-https-1.0.0.tgz",
"integrity": "sha1-L5CN1fHbQGjAWM1ubUzjkskTOJs="
},
"http-response-object": {
"version": "3.0.2",
"resolved": "https://registry.npmjs.org/http-response-object/-/http-response-object-3.0.2.tgz",
"integrity": "sha512-bqX0XTF6fnXSQcEJ2Iuyr75yVakyjIDCqroJQ/aHfSdlM743Cwqoi2nDYMzLGWUcuTWGWy8AAvOKXTfiv6q9RA==",
"dev": true,
"requires": {
"@types/node": "^10.0.3"
},
"dependencies": {
"@types/node": {
"version": "10.17.60",
"resolved": "https://registry.npmjs.org/@types/node/-/node-10.17.60.tgz",
"integrity": "sha512-F0KIgDJfy2nA3zMLmWGKxcH2ZVEtCZXHHdOQs2gSaQ27+lNeEfGxzkIw90aXswATX7AZ33tahPbzy6KAfUreVw==",
"dev": true
}
}
},
"http-signature": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
@@ -17468,6 +17781,12 @@
"object-visit": "^1.0.0"
}
},
"markdown-table": {
"version": "1.1.3",
"resolved": "https://registry.npmjs.org/markdown-table/-/markdown-table-1.1.3.tgz",
"integrity": "sha512-1RUZVgQlpJSPWYbFSpmudq5nHY1doEIv89gBtF0s4gW1GF2XorxcA/70M5vq7rLv0a6mhOUccRsqkwhwLCIQ2Q==",
"dev": true
},
"mcl-wasm": {
"version": "0.7.9",
"resolved": "https://registry.npmjs.org/mcl-wasm/-/mcl-wasm-0.7.9.tgz",
@@ -17953,6 +18272,11 @@
}
}
},
"nan": {
"version": "2.15.0",
"resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz",
"integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ=="
},
"nano-base32": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/nano-base32/-/nano-base32-1.0.1.tgz",
@@ -18472,6 +18796,12 @@
"safe-buffer": "^5.1.1"
}
},
"parse-cache-control": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/parse-cache-control/-/parse-cache-control-1.0.1.tgz",
"integrity": "sha1-juqz5U+laSD+Fro493+iGqzC104=",
"dev": true
},
"parse-headers": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/parse-headers/-/parse-headers-2.0.4.tgz",
@@ -18697,6 +19027,15 @@
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
"integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
},
"promise": {
"version": "8.1.0",
"resolved": "https://registry.npmjs.org/promise/-/promise-8.1.0.tgz",
"integrity": "sha512-W04AqnILOL/sPRXziNicCjSNRruLAuIHEOVBazepu0545DDNGYHz7ar9ZgZ1fMU8/MA4mVxp5rkBWRi6OXIy3Q==",
"dev": true,
"requires": {
"asap": "~2.0.6"
}
},
"proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
@@ -18928,6 +19267,24 @@
"resolved": "https://registry.npmjs.org/repeat-string/-/repeat-string-1.6.1.tgz",
"integrity": "sha1-jcrkcOHIirwtYA//Sndihtp15jc="
},
"req-cwd": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/req-cwd/-/req-cwd-2.0.0.tgz",
"integrity": "sha1-1AgrTURZgDZkD7c93qAe1T20nrw=",
"dev": true,
"requires": {
"req-from": "^2.0.0"
}
},
"req-from": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/req-from/-/req-from-2.0.0.tgz",
"integrity": "sha1-10GI5H+TeW9Kpx327jWuaJ8+DnA=",
"dev": true,
"requires": {
"resolve-from": "^3.0.0"
}
},
"request": {
"version": "2.88.2",
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
@@ -18972,6 +19329,26 @@
}
}
},
"request-promise-core": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/request-promise-core/-/request-promise-core-1.1.4.tgz",
"integrity": "sha512-TTbAfBBRdWD7aNNOoVOBH4pN/KigV6LyapYNNlAPA8JwbovRti1E88m3sYAwsLi5ryhPKsE9APwnjFTgdUjTpw==",
"dev": true,
"requires": {
"lodash": "^4.17.19"
}
},
"request-promise-native": {
"version": "1.0.9",
"resolved": "https://registry.npmjs.org/request-promise-native/-/request-promise-native-1.0.9.tgz",
"integrity": "sha512-wcW+sIUiWnKgNY0dqCpOZkUbF/I+YPi+f09JZIDa39Ec+q82CpSYniDp+ISgTTbKmnpJWASeJBPZmoxH84wt3g==",
"dev": true,
"requires": {
"request-promise-core": "1.1.4",
"stealthy-require": "^1.1.1",
"tough-cookie": "^2.3.3"
}
},
"require-directory": {
"version": "2.1.1",
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
@@ -18997,6 +19374,12 @@
"path-parse": "^1.0.6"
}
},
"resolve-from": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-3.0.0.tgz",
"integrity": "sha1-six699nWiBvItuZTM17rywoYh0g=",
"dev": true
},
"resolve-url": {
"version": "0.2.1",
"resolved": "https://registry.npmjs.org/resolve-url/-/resolve-url-0.2.1.tgz",
@@ -19312,6 +19695,16 @@
"safe-buffer": "^5.0.1"
}
},
"sha1": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/sha1/-/sha1-1.1.1.tgz",
"integrity": "sha1-rdqnqTFo85PxnrKxUJFhjicA+Eg=",
"dev": true,
"requires": {
"charenc": ">= 0.0.1",
"crypt": ">= 0.0.1"
}
},
"sha3": {
"version": "2.1.4",
"resolved": "https://registry.npmjs.org/sha3/-/sha3-2.1.4.tgz",
@@ -19812,6 +20205,12 @@
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
},
"stealthy-require": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/stealthy-require/-/stealthy-require-1.1.1.tgz",
"integrity": "sha1-NbCYdbT/SfJqd35QmzCQoyJr8ks=",
"dev": true
},
"stream-browserify": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/stream-browserify/-/stream-browserify-2.0.2.tgz",
@@ -20095,6 +20494,26 @@
}
}
},
"sync-request": {
"version": "6.1.0",
"resolved": "https://registry.npmjs.org/sync-request/-/sync-request-6.1.0.tgz",
"integrity": "sha512-8fjNkrNlNCrVc/av+Jn+xxqfCjYaBoHqCsDz6mt030UMxJGr+GSfCV1dQt2gRtlL63+VPidwDVLr7V2OcTSdRw==",
"dev": true,
"requires": {
"http-response-object": "^3.0.1",
"sync-rpc": "^1.2.1",
"then-request": "^6.0.0"
}
},
"sync-rpc": {
"version": "1.3.6",
"resolved": "https://registry.npmjs.org/sync-rpc/-/sync-rpc-1.3.6.tgz",
"integrity": "sha512-J8jTXuZzRlvU7HemDgHi3pGnh/rkoqR/OZSjhTyyZrEkkYQbk7Z33AXp37mkPfPpfdOuj7Ex3H/TJM1z48uPQw==",
"dev": true,
"requires": {
"get-port": "^3.1.0"
}
},
"tapable": {
"version": "0.2.9",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-0.2.9.tgz",
@@ -20140,6 +20559,44 @@
"resolved": "https://registry.npmjs.org/testrpc/-/testrpc-0.0.1.tgz",
"integrity": "sha512-afH1hO+SQ/VPlmaLUFj2636QMeDvPCeQMc/9RBMW0IfjNe9gFD9Ra3ShqYkB7py0do1ZcCna/9acHyzTJ+GcNA=="
},
"then-request": {
"version": "6.0.2",
"resolved": "https://registry.npmjs.org/then-request/-/then-request-6.0.2.tgz",
"integrity": "sha512-3ZBiG7JvP3wbDzA9iNY5zJQcHL4jn/0BWtXIkagfz7QgOL/LqjCEOBQuJNZfu0XYnv5JhKh+cDxCPM4ILrqruA==",
"dev": true,
"requires": {
"@types/concat-stream": "^1.6.0",
"@types/form-data": "0.0.33",
"@types/node": "^8.0.0",
"@types/qs": "^6.2.31",
"caseless": "~0.12.0",
"concat-stream": "^1.6.0",
"form-data": "^2.2.0",
"http-basic": "^8.1.1",
"http-response-object": "^3.0.1",
"promise": "^8.0.0",
"qs": "^6.4.0"
},
"dependencies": {
"@types/node": {
"version": "8.10.66",
"resolved": "https://registry.npmjs.org/@types/node/-/node-8.10.66.tgz",
"integrity": "sha512-tktOkFUA4kXx2hhhrB8bIFb5TbwzS4uOhKEmwiD+NoiL0qtP2OQ9mFldbgD4dV1djrlBYP6eBuQZiWjuHUpqFw==",
"dev": true
},
"form-data": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.1.tgz",
"integrity": "sha512-m21N3WOmEEURgk6B9GLOE4RuWOFf28Lhh9qGYeNlGq4VDXUlJy2th2slBNU8Gp8EzloYZOibZJ7t5ecIrFSjVA==",
"dev": true,
"requires": {
"asynckit": "^0.4.0",
"combined-stream": "^1.0.6",
"mime-types": "^2.1.12"
}
}
}
},
"timed-out": {
"version": "4.0.1",
"resolved": "https://registry.npmjs.org/timed-out/-/timed-out-4.0.1.tgz",
@@ -20383,6 +20840,12 @@
}
}
},
"typedarray": {
"version": "0.0.6",
"resolved": "https://registry.npmjs.org/typedarray/-/typedarray-0.0.6.tgz",
"integrity": "sha1-hnrHTjhkGHsdPUfZlqeOxciDB3c=",
"dev": true
},
"typedarray-to-buffer": {
"version": "3.1.5",
"resolved": "https://registry.npmjs.org/typedarray-to-buffer/-/typedarray-to-buffer-3.1.5.tgz",
@@ -20853,7 +21316,11 @@
"version": "1.2.13",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz",
"integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==",
"optional": true
"optional": true,
"requires": {
"bindings": "^1.5.0",
"nan": "^2.12.1"
}
},
"glob-parent": {
"version": "3.1.0",
@@ -7,6 +7,7 @@
"ethereum-waffle": "^3.4.0",
"ethers": "^5.5.3",
"hardhat": "^2.6.4",
"hardhat-gas-reporter": "^1.0.7",
"solidity-coverage": "^0.7.17"
},
"dependencies": {
@@ -0,0 +1,34 @@
const { ethers } = require('hardhat');
const { constants } = require('@openzeppelin/test-helpers');
const contracts = require("../../contractAddresses.json");
const fs = require('file-system');
async function main() {
const BandwidthGenerator = await ethers.getContractFactory("BandwidthGenerator");
console.log('preparing to deploy contract...')
// if this is failing, check whether the ERC20 address has been manually added to the contract addresses json file
const bandwidthGenerator = await BandwidthGenerator.deploy(
contracts.mainnet.NYMT,
contracts.mainnet.GRAVITY
);
console.log('...contract successfully deployed...');
contracts.mainnet.BANDWIDTH_GENERATOR_NYMT = bandwidthGenerator.address;
// the location of the json file is relative to where you are running the script from - run from root of directory
fs.writeFileSync('./contractAddresses.json', JSON.stringify(contracts), (err) => {
if (err) throw err;
});
console.log(`...bandwidthGenerator.sol deployed at ${bandwidthGenerator.address}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
@@ -0,0 +1,41 @@
const { ethers } = require('hardhat');
const { constants } = require('@openzeppelin/test-helpers');
const contracts = require("../../contractAddresses.json");
const fs = require('file-system');
async function main() {
const BandwidthGenerator = await ethers.getContractFactory("BandwidthGenerator");
const bandwidthGenerator = await BandwidthGenerator.attach(contracts.mainnet.BANDWIDTH_GENERATOR_NYMT);
console.log(`grabbed BANDWIDTH contract at ${bandwidthGenerator.address}`);
const Token = await ethers.getContractFactory("CosmosERC20");
const erc20nym = await Token.attach(contracts.mainnet.NYMT);
console.log(`grabbed ERC20 NYM contract at ${erc20nym.address}`);
let check = await bandwidthGenerator.owner();
console.log(`owner is ${check}`);
console.log(`approving 1 NYMT for transfer to BANDWIDTH`);
await erc20nym.approve(bandwidthGenerator.address, 1000000);
console.log(`approved successfully`);
console.log('...');
console.log(`generating bbc`);
await bandwidthGenerator.generateBasicBandwidthCredential(
1000000,
"8513226889913878556430235353454720565401242598665291259741189869506713110335",
"0x045184e31380e0201c65c96a9a2947007f919c814c612898d062943d6dce06d4401cd319471d63dd65920ea0698310a832feeb9fbfc98b7bddefdcdfc1f8c60e",
"nymt134er36g8l5h36u3y793jcxxvvaqncgqvemww2l"
);
console.log(`success! check etherscan for emitted events: https://etherscan.io/address/${bandwidthGenerator.address}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
@@ -1,8 +1,8 @@
// arguments for verification of gravity contract via hardhat-etherscan plugin
// npx hardhat verify --constructor-args ./scripts/mainnet/mainnet-token-args.js --network mainnet 0xCf6DeE9947fdDc958985E5283e63d41CBC83Ff61
module.exports = [
"0xa4108aA1Ec4967F8b52220a4f7e94A8201F2D906",
"nym",
"nym",
"",
"NYM",
"NYM",
6
];
@@ -0,0 +1,29 @@
const { ethers } = require('hardhat');
const { constants } = require('@openzeppelin/test-helpers');
const contracts = require("../../contractAddresses.json");
const fs = require('file-system');
async function main() {
const BandwidthGenerator = await ethers.getContractFactory("BandwidthGeneratorNoGravity");
// if this is failing, check whether the ERC20 address has been manually added to the contract addresses json file
const bandwidthGenerator = await BandwidthGenerator.deploy(
contracts.rinkeby.NYM_ERC20
);
console.log("deploying...");
contracts.rinkeby.BANDWIDTH_GENERATOR_NO_GRAVITY = bandwidthGenerator.address;
// the location of the json file is relative to where you are running the script from - run from root of directory
fs.writeFileSync('./contractAddresses.json', JSON.stringify(contracts), (err) => {
if (err) throw err;
});
console.log(`...bandwidthGenerator.sol deployed at ${bandwidthGenerator.address}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
@@ -8,7 +8,7 @@ async function main() {
// if this is failing, check whether the ERC20 address has been manually added to the contract addresses json file
const bandwidthGenerator = await BandwidthGenerator.deploy(
contracts.rinkeby.NYM_ERC20,
contracts.rinkeby.GRAVITY
contracts.rinkeby.TEST_GRAVITY
);
console.log("deploying...");
@@ -0,0 +1,32 @@
const { ethers } = require('hardhat');
const { constants } = require('@openzeppelin/test-helpers');
const contracts = require("../../contractAddresses.json");
const fs = require('file-system');
async function main() {
const [deployer] = await ethers.getSigners();
console.log(deployer.address);
console.log(constants.ZERO_BYTES32);
const Gravity = await ethers.getContractFactory("TestGravity");
// deploy with args from unit tests
const gravity = await Gravity.deploy(
constants.ZERO_BYTES32,
[deployer.address],
[2863311531]
);
contracts.rinkeby.TEST_GRAVITY = gravity.address;
// the location of the json file is relative to where you are running the script from - run from root of directory
fs.writeFileSync('./contractAddresses.json', JSON.stringify(contracts), (err) => {
if (err) throw err;
});
console.log(`gravity.sol deployed at ${gravity.address}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
@@ -0,0 +1,40 @@
const { ethers } = require('hardhat');
const { constants } = require('@openzeppelin/test-helpers');
const contracts = require("../../contractAddresses.json");
const fs = require('file-system');
async function main() {
const BandwidthGenerator = await ethers.getContractFactory("BandwidthGenerator");
const bandwidthGenerator = await BandwidthGenerator.attach(contracts.rinkeby.BANDWIDTH_GENERATOR);
console.log(`grabbed BANDWIDTH contract at ${bandwidthGenerator.address}`);
const Token = await ethers.getContractFactory("CosmosERC20");
const erc20nym = await Token.attach(contracts.rinkeby.NYM_ERC20);
console.log(`grabbed ERC20 NYM contract at ${erc20nym.address}`);
let check = await bandwidthGenerator.owner();
console.log(`owner is ${check}`);
console.log(`approving 1 NYM for transfer to BANDWIDTH`);
await erc20nym.approve(bandwidthGenerator.address, 1000000);
console.log(`approved successfully`);
console.log('...');
console.log(`generating bbc`);
await bandwidthGenerator.generateBasicBandwidthCredential(
1000000,
"8513226889913878556430235353454720565401242598665291259741189869506713110335",
"0x045184e31380e0201c65c96a9a2947007f919c814c612898d062943d6dce06d4401cd319471d63dd65920ea0698310a832feeb9fbfc98b7bddefdcdfc1f8c60e",
"nymt134er36g8l5h36u3y793jcxxvvaqncgqvemww2l"
);
console.log(`success! check etherscan for emitted events: https://rinkeby.etherscan.io/address/${bandwidthGenerator.address}`);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
@@ -1,7 +1,6 @@
// arguments for verification of gravity contract via hardhat-etherscan plugin
module.exports = [
"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B",
"test",
"tst",
"0x8383D4741e926549c9B42938B512A0fbF6Ccc8A0",
"testn",
"testn",
6
];
@@ -16,10 +16,10 @@ contract('BandwidthGenerator', (accounts) => {
let cosmosRecipient = "nymt1f06hzmwf9chqewkpv93ajk6tayzp4784m2da9x"; // random sandbox testnet address
let initialRatio = 1073741824; // 1073741824 bytes = 1GB
let newRatio;
let tokenAmount = web3.utils.toWei('100'); // this is converting 100 tokens to their representation in wei: 100000000000000000000
let halfTokenAmount = web3.utils.toWei('50');
let unevenTokenAmount = web3.utils.toWei('11.5'); // 11500000000000000000
let oneToken = web3.utils.toWei('1');
let tokenAmount = 100000000; // not using toWei as comsos erc20 token has 6 decimals instead of standard 18
let halfTokenAmount = 50000000;
let unevenTokenAmount = 11500000;
let oneToken = 1000000;
before('deploy contracts', async () => {
@@ -103,7 +103,7 @@ contract('BandwidthGenerator', (accounts) => {
{ from: user }
);
let expectedBandwidthInMB = ((halfTokenAmount/10**18)*initialRatio); // 50 * (1024*1024*1024) bytes = 51200MB = 50GB of bandwidth
let expectedBandwidthInMB = ((halfTokenAmount/10**6)*initialRatio);
await expectEvent.inTransaction(tx.tx, bandwidthGenerator, 'BBCredentialPurchased', {
Bandwidth: expectedBandwidthInMB.toString(),
@@ -121,16 +121,13 @@ contract('BandwidthGenerator', (accounts) => {
_tokenContract: erc20token.address,
_sender: bandwidthGenerator.address,
_destination: cosmosRecipient,
_amount: halfTokenAmount
_amount: halfTokenAmount.toString()
});
expect((await erc20token.balanceOf(bandwidthGenerator.address)).toString()).to.equal('0');
expect((await erc20token.balanceOf(user)).toString()).to.equal(halfTokenAmount.toString());
});
/**
* This can be out by a float still with amounts such as '.1'
*/
it("it transfers for uneven token amounts", async () => {
let tx = await bandwidthGenerator.generateBasicBandwidthCredential(
unevenTokenAmount,
@@ -141,7 +138,7 @@ contract('BandwidthGenerator', (accounts) => {
{ from: user }
);
let newexpectedBandwidthInMB = ((11500000000000000000*initialRatio)/10**18);
let newexpectedBandwidthInMB = ((11500000*initialRatio)/10**6);
await expectEvent.inTransaction(tx.tx, bandwidthGenerator, 'BBCredentialPurchased', {
Bandwidth: newexpectedBandwidthInMB.toString(),
@@ -159,7 +156,7 @@ contract('BandwidthGenerator', (accounts) => {
_tokenContract: erc20token.address,
_sender: bandwidthGenerator.address,
_destination: cosmosRecipient,
_amount: unevenTokenAmount
_amount: unevenTokenAmount.toString()
});
});
@@ -204,7 +201,7 @@ contract('BandwidthGenerator', (accounts) => {
{ from: user }
);
let expectedBandwidthInMB = ((oneToken/10**18)*newRatio);
let expectedBandwidthInMB = ((oneToken/10**6)*newRatio);
await expectEvent.inTransaction(tx.tx, bandwidthGenerator, 'BBCredentialPurchased', {
Bandwidth: expectedBandwidthInMB.toString(),
@@ -222,7 +219,7 @@ contract('BandwidthGenerator', (accounts) => {
_tokenContract: erc20token.address,
_sender: bandwidthGenerator.address,
_destination: cosmosRecipient,
_amount: oneToken
_amount: oneToken.toString()
});
});
});