From 1acdb0c5198dabb6ba52fb20df05b4179cfae687 Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 10 Jan 2022 11:23:20 +0100 Subject: [PATCH 01/73] updated scripts + gitignore --- .../basic-bandwidth-generation/.gitignore | 1 + .../contractAddresses.json | 8 +++++ .../basic-bandwidth-generation/package.json | 2 +- .../scripts/deploy.js | 30 +++++++++++++++++++ .../test/BandwidthGenerator.js | 2 +- 5 files changed, 41 insertions(+), 2 deletions(-) create mode 100644 contracts/basic-bandwidth-generation/contractAddresses.json create mode 100644 contracts/basic-bandwidth-generation/scripts/deploy.js diff --git a/contracts/basic-bandwidth-generation/.gitignore b/contracts/basic-bandwidth-generation/.gitignore index c071436eee..b76c36af73 100644 --- a/contracts/basic-bandwidth-generation/.gitignore +++ b/contracts/basic-bandwidth-generation/.gitignore @@ -1,5 +1,6 @@ node_modules ../.env +.to_do.md #Hardhat files cache diff --git a/contracts/basic-bandwidth-generation/contractAddresses.json b/contracts/basic-bandwidth-generation/contractAddresses.json new file mode 100644 index 0000000000..07d071452f --- /dev/null +++ b/contracts/basic-bandwidth-generation/contractAddresses.json @@ -0,0 +1,8 @@ +{ + "Rinkeby": + { + "NYM_ERC20":"", + "BANDWIDTH_GENERATOR":"", + "GRAVITY":"" + } +} diff --git a/contracts/basic-bandwidth-generation/package.json b/contracts/basic-bandwidth-generation/package.json index 910d7a4541..933fd6e4e7 100644 --- a/contracts/basic-bandwidth-generation/package.json +++ b/contracts/basic-bandwidth-generation/package.json @@ -12,7 +12,7 @@ "dependencies": { "@nomiclabs/hardhat-truffle5": "^2.0.2", "@nomiclabs/hardhat-web3": "^2.0.0", - "@openzeppelin/contracts": "^4.4.1", + "@openzeppelin/contracts": "^4.3.2", "@openzeppelin/test-helpers": "^0.5.15", "dotenv": "^10.0.0", "find-config": "^1.0.0" diff --git a/contracts/basic-bandwidth-generation/scripts/deploy.js b/contracts/basic-bandwidth-generation/scripts/deploy.js new file mode 100644 index 0000000000..aa0943d76e --- /dev/null +++ b/contracts/basic-bandwidth-generation/scripts/deploy.js @@ -0,0 +1,30 @@ +const { ethers } = require('hardhat'); +const contracts = require('../contractAddresses.json'); + +async function main() { + const [deployer] = await ethers.getSigners(); + + console.log("Deploying contracts with the account:", deployer.address); + + // console.log("Account balance:", (await deployer.getBalance()).toString()); + const balance = await provider.getBalance(deployer.address); + console.log(balance) + + // const BurnableToken = await ethers.getContractFactory("BurnableToken"); + // const burnToken = await BurnableToken.deploy("BURNTOKEN","B4A"); + // console.log(`token deployed at ${burnToken.address}`); + + // const BurnForAccess = await ethers.getContractFactory("BurnForAccess"); + // const burn4access = await BurnForAccess.deploy(burnToken.address); + // const burn4access = await BurnForAccess.deploy(contracts.Rinkeby.BurnableToken); + + // console.log(`Burn4Access contract deployed at ${burn4access.address}`); + // TODO automatically update contractAddresses.json +} + +main() + .then(() => process.exit(0)) + .catch((error) => { + console.error(error); + process.exit(1); + }); diff --git a/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js b/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js index 22851bc480..ce36ec90f9 100644 --- a/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js +++ b/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js @@ -35,7 +35,7 @@ contract('BandwidthGenerator', (accounts) => { 'eNYM', 'NYMERC20', 'NYM', - 18 + 6 ); // grab event args for getting token address From 1647c368fbdfcfe763db960c07ae92e88183413f Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 10 Jan 2022 12:19:26 +0100 Subject: [PATCH 02/73] updates: * pragma bump to 0.8.10 * updated gravity bridge contracts * moved modified contracts to new 'test' dir for unit test clarity --- .../token/ERC20/ERC20.sol/ERC20.dbg.json | 2 +- .../token/ERC20/ERC20.sol/ERC20.json | 4 +- .../token/ERC20/IERC20.sol/IERC20.dbg.json | 2 +- .../IERC20Metadata.dbg.json | 2 +- .../utils/Context.sol/Context.dbg.json | 2 +- .../math/SafeMath.sol/SafeMath.dbg.json | 4 - .../contracts/math/SafeMath.sol/SafeMath.json | 10 - .../token/ERC20/ERC20.sol/ERC20.dbg.json | 4 - .../token/ERC20/ERC20.sol/ERC20.json | 297 -------- .../token/ERC20/IERC20.sol/IERC20.dbg.json | 4 - .../token/ERC20/IERC20.sol/IERC20.json | 194 ----- .../ERC20/SafeERC20.sol/SafeERC20.dbg.json | 4 - .../token/ERC20/SafeERC20.sol/SafeERC20.json | 10 - .../utils/Address.sol/Address.dbg.json | 4 - .../contracts/utils/Address.sol/Address.json | 10 - .../utils/Context.sol/Context.dbg.json | 4 - .../contracts/utils/Context.sol/Context.json | 10 - .../ReentrancyGuard.dbg.json | 4 - .../ReentrancyGuard.sol/ReentrancyGuard.json | 16 - .../BandwidthGenerator.json | 222 ------ .../CosmosToken.sol/CosmosERC20.dbg.json | 4 - .../CosmosToken.sol/CosmosERC20.json | 325 --------- .../contracts/Gravity.sol/Gravity.dbg.json | 4 - .../contracts/Gravity.sol/Gravity.json | 678 ------------------ .../cache/solidity-files-cache.json | 330 ++++++--- .../contracts/BandwidthGenerator.sol | 10 +- .../contracts/CosmosToken.sol | 46 +- .../contracts/Gravity.sol | 520 ++++++++------ .../test-contracts/TestCosmosToken.sol | 55 ++ .../contracts/test-contracts/TestGravity.sol | 671 +++++++++++++++++ .../hardhat.config.js | 8 +- .../package-lock.json | 6 +- .../basic-bandwidth-generation/package.json | 2 +- 33 files changed, 1298 insertions(+), 2170 deletions(-) delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/math/SafeMath.sol/SafeMath.dbg.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/math/SafeMath.sol/SafeMath.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/SafeERC20.sol/SafeERC20.dbg.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/SafeERC20.sol/SafeERC20.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Address.sol/Address.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Context.sol/Context.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/ReentrancyGuard.sol/ReentrancyGuard.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/contracts/BandwidthGenerator.sol/BandwidthGenerator.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/contracts/CosmosToken.sol/CosmosERC20.dbg.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/contracts/CosmosToken.sol/CosmosERC20.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/contracts/Gravity.sol/Gravity.dbg.json delete mode 100644 contracts/basic-bandwidth-generation/artifacts/contracts/contracts/Gravity.sol/Gravity.json create mode 100644 contracts/basic-bandwidth-generation/contracts/test-contracts/TestCosmosToken.sol create mode 100644 contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json index 8a9759bdf8..fd02eec0ea 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/6dfbc7f87ae3c2727d63a3fba8d02a41.json" + "buildInfo": "../../../../../build-info/b4e7ec2fd35748689d35a44cde08a2e7.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json index 9d6ac8dd00..8fd7d531d1 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json @@ -290,8 +290,8 @@ "type": "function" } ], - "bytecode": "0x60806040523480156200001157600080fd5b506040516200171b3803806200171b833981810160405281019062000037919062000193565b81600390805190602001906200004f92919062000071565b5080600490805190602001906200006892919062000071565b50505062000376565b8280546200007f906200029b565b90600052602060002090601f016020900481019282620000a35760008555620000ef565b82601f10620000be57805160ff1916838001178555620000ef565b82800160010185558215620000ef579182015b82811115620000ee578251825591602001919060010190620000d1565b5b509050620000fe919062000102565b5090565b5b808211156200011d57600081600090555060010162000103565b5090565b60006200013862000132846200022f565b62000206565b9050828152602081018484840111156200015157600080fd5b6200015e84828562000265565b509392505050565b600082601f8301126200017857600080fd5b81516200018a84826020860162000121565b91505092915050565b60008060408385031215620001a757600080fd5b600083015167ffffffffffffffff811115620001c257600080fd5b620001d08582860162000166565b925050602083015167ffffffffffffffff811115620001ee57600080fd5b620001fc8582860162000166565b9150509250929050565b60006200021262000225565b9050620002208282620002d1565b919050565b6000604051905090565b600067ffffffffffffffff8211156200024d576200024c62000336565b5b620002588262000365565b9050602081019050919050565b60005b838110156200028557808201518184015260208101905062000268565b8381111562000295576000848401525b50505050565b60006002820490506001821680620002b457607f821691505b60208210811415620002cb57620002ca62000307565b5b50919050565b620002dc8262000365565b810181811067ffffffffffffffff82111715620002fe57620002fd62000336565b5b80604052505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b6000601f19601f8301169050919050565b61139580620003866000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e35565b60405180910390f35b6100e660048036038101906100e19190610c83565b610308565b6040516100f39190610e1a565b60405180910390f35b610104610326565b6040516101119190610f37565b60405180910390f35b610134600480360381019061012f9190610c34565b610330565b6040516101419190610e1a565b60405180910390f35b610152610428565b60405161015f9190610f52565b60405180910390f35b610182600480360381019061017d9190610c83565b610431565b60405161018f9190610e1a565b60405180910390f35b6101b260048036038101906101ad9190610bcf565b6104dd565b6040516101bf9190610f37565b60405180910390f35b6101d0610525565b6040516101dd9190610e35565b60405180910390f35b61020060048036038101906101fb9190610c83565b6105b7565b60405161020d9190610e1a565b60405180910390f35b610230600480360381019061022b9190610c83565b6106a2565b60405161023d9190610e1a565b60405180910390f35b610260600480360381019061025b9190610bf8565b6106c0565b60405161026d9190610f37565b60405180910390f35b60606003805461028590611067565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190611067565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610747565b848461074f565b6001905092915050565b6000600254905090565b600061033d84848461091a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610eb7565b60405180910390fd5b61041c85610414610747565b85840361074f565b60019150509392505050565b60006012905090565b60006104d361043e610747565b84846001600061044c610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104ce9190610f89565b61074f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053490611067565b80601f016020809104026020016040519081016040528092919081815260200182805461056090611067565b80156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b5050505050905090565b600080600160006105c6610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067a90610f17565b60405180910390fd5b61069761068e610747565b8585840361074f565b600191505092915050565b60006106b66106af610747565b848461091a565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b690610ef7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561082f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082690610e77565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161090d9190610f37565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098190610ed7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f190610e57565b60405180910390fd5b610a05838383610b9b565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8290610e97565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e9190610f89565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b829190610f37565b60405180910390a3610b95848484610ba0565b50505050565b505050565b505050565b600081359050610bb481611331565b92915050565b600081359050610bc981611348565b92915050565b600060208284031215610be157600080fd5b6000610bef84828501610ba5565b91505092915050565b60008060408385031215610c0b57600080fd5b6000610c1985828601610ba5565b9250506020610c2a85828601610ba5565b9150509250929050565b600080600060608486031215610c4957600080fd5b6000610c5786828701610ba5565b9350506020610c6886828701610ba5565b9250506040610c7986828701610bba565b9150509250925092565b60008060408385031215610c9657600080fd5b6000610ca485828601610ba5565b9250506020610cb585828601610bba565b9150509250929050565b610cc881610ff1565b82525050565b6000610cd982610f6d565b610ce38185610f78565b9350610cf3818560208601611034565b610cfc816110f7565b840191505092915050565b6000610d14602383610f78565b9150610d1f82611108565b604082019050919050565b6000610d37602283610f78565b9150610d4282611157565b604082019050919050565b6000610d5a602683610f78565b9150610d65826111a6565b604082019050919050565b6000610d7d602883610f78565b9150610d88826111f5565b604082019050919050565b6000610da0602583610f78565b9150610dab82611244565b604082019050919050565b6000610dc3602483610f78565b9150610dce82611293565b604082019050919050565b6000610de6602583610f78565b9150610df1826112e2565b604082019050919050565b610e058161101d565b82525050565b610e1481611027565b82525050565b6000602082019050610e2f6000830184610cbf565b92915050565b60006020820190508181036000830152610e4f8184610cce565b905092915050565b60006020820190508181036000830152610e7081610d07565b9050919050565b60006020820190508181036000830152610e9081610d2a565b9050919050565b60006020820190508181036000830152610eb081610d4d565b9050919050565b60006020820190508181036000830152610ed081610d70565b9050919050565b60006020820190508181036000830152610ef081610d93565b9050919050565b60006020820190508181036000830152610f1081610db6565b9050919050565b60006020820190508181036000830152610f3081610dd9565b9050919050565b6000602082019050610f4c6000830184610dfc565b92915050565b6000602082019050610f676000830184610e0b565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f948261101d565b9150610f9f8361101d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fd457610fd3611099565b5b828201905092915050565b6000610fea82610ffd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611052578082015181840152602081019050611037565b83811115611061576000848401525b50505050565b6000600282049050600182168061107f57607f821691505b60208210811415611093576110926110c8565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61133a81610fdf565b811461134557600080fd5b50565b6113518161101d565b811461135c57600080fd5b5056fea2646970667358221220b3c129c93663de4578dfe5a3ceef494143e28bb9ac4461738559f65db42d2db064736f6c63430008040033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461016857806370a082311461019857806395d89b41146101c8578063a457c2d7146101e6578063a9059cbb14610216578063dd62ed3e14610246576100a9565b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100fc57806323b872dd1461011a578063313ce5671461014a575b600080fd5b6100b6610276565b6040516100c39190610e35565b60405180910390f35b6100e660048036038101906100e19190610c83565b610308565b6040516100f39190610e1a565b60405180910390f35b610104610326565b6040516101119190610f37565b60405180910390f35b610134600480360381019061012f9190610c34565b610330565b6040516101419190610e1a565b60405180910390f35b610152610428565b60405161015f9190610f52565b60405180910390f35b610182600480360381019061017d9190610c83565b610431565b60405161018f9190610e1a565b60405180910390f35b6101b260048036038101906101ad9190610bcf565b6104dd565b6040516101bf9190610f37565b60405180910390f35b6101d0610525565b6040516101dd9190610e35565b60405180910390f35b61020060048036038101906101fb9190610c83565b6105b7565b60405161020d9190610e1a565b60405180910390f35b610230600480360381019061022b9190610c83565b6106a2565b60405161023d9190610e1a565b60405180910390f35b610260600480360381019061025b9190610bf8565b6106c0565b60405161026d9190610f37565b60405180910390f35b60606003805461028590611067565b80601f01602080910402602001604051908101604052809291908181526020018280546102b190611067565b80156102fe5780601f106102d3576101008083540402835291602001916102fe565b820191906000526020600020905b8154815290600101906020018083116102e157829003601f168201915b5050505050905090565b600061031c610315610747565b848461074f565b6001905092915050565b6000600254905090565b600061033d84848461091a565b6000600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000610388610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610408576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016103ff90610eb7565b60405180910390fd5b61041c85610414610747565b85840361074f565b60019150509392505050565b60006012905090565b60006104d361043e610747565b84846001600061044c610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546104ce9190610f89565b61074f565b6001905092915050565b60008060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b60606004805461053490611067565b80601f016020809104026020016040519081016040528092919081815260200182805461056090611067565b80156105ad5780601f10610582576101008083540402835291602001916105ad565b820191906000526020600020905b81548152906001019060200180831161059057829003601f168201915b5050505050905090565b600080600160006105c6610747565b73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905082811015610683576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161067a90610f17565b60405180910390fd5b61069761068e610747565b8585840361074f565b600191505092915050565b60006106b66106af610747565b848461091a565b6001905092915050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b600033905090565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff1614156107bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016107b690610ef7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561082f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161082690610e77565b60405180910390fd5b80600160008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055508173ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9258360405161090d9190610f37565b60405180910390a3505050565b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561098a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161098190610ed7565b60405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156109fa576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004016109f190610e57565b60405180910390fd5b610a05838383610b9b565b60008060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905081811015610a8b576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610a8290610e97565b60405180910390fd5b8181036000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002081905550816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254610b1e9190610f89565b925050819055508273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef84604051610b829190610f37565b60405180910390a3610b95848484610ba0565b50505050565b505050565b505050565b600081359050610bb481611331565b92915050565b600081359050610bc981611348565b92915050565b600060208284031215610be157600080fd5b6000610bef84828501610ba5565b91505092915050565b60008060408385031215610c0b57600080fd5b6000610c1985828601610ba5565b9250506020610c2a85828601610ba5565b9150509250929050565b600080600060608486031215610c4957600080fd5b6000610c5786828701610ba5565b9350506020610c6886828701610ba5565b9250506040610c7986828701610bba565b9150509250925092565b60008060408385031215610c9657600080fd5b6000610ca485828601610ba5565b9250506020610cb585828601610bba565b9150509250929050565b610cc881610ff1565b82525050565b6000610cd982610f6d565b610ce38185610f78565b9350610cf3818560208601611034565b610cfc816110f7565b840191505092915050565b6000610d14602383610f78565b9150610d1f82611108565b604082019050919050565b6000610d37602283610f78565b9150610d4282611157565b604082019050919050565b6000610d5a602683610f78565b9150610d65826111a6565b604082019050919050565b6000610d7d602883610f78565b9150610d88826111f5565b604082019050919050565b6000610da0602583610f78565b9150610dab82611244565b604082019050919050565b6000610dc3602483610f78565b9150610dce82611293565b604082019050919050565b6000610de6602583610f78565b9150610df1826112e2565b604082019050919050565b610e058161101d565b82525050565b610e1481611027565b82525050565b6000602082019050610e2f6000830184610cbf565b92915050565b60006020820190508181036000830152610e4f8184610cce565b905092915050565b60006020820190508181036000830152610e7081610d07565b9050919050565b60006020820190508181036000830152610e9081610d2a565b9050919050565b60006020820190508181036000830152610eb081610d4d565b9050919050565b60006020820190508181036000830152610ed081610d70565b9050919050565b60006020820190508181036000830152610ef081610d93565b9050919050565b60006020820190508181036000830152610f1081610db6565b9050919050565b60006020820190508181036000830152610f3081610dd9565b9050919050565b6000602082019050610f4c6000830184610dfc565b92915050565b6000602082019050610f676000830184610e0b565b92915050565b600081519050919050565b600082825260208201905092915050565b6000610f948261101d565b9150610f9f8361101d565b9250827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff03821115610fd457610fd3611099565b5b828201905092915050565b6000610fea82610ffd565b9050919050565b60008115159050919050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b6000819050919050565b600060ff82169050919050565b60005b83811015611052578082015181840152602081019050611037565b83811115611061576000848401525b50505050565b6000600282049050600182168061107f57607f821691505b60208210811415611093576110926110c8565b5b50919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b6000601f19601f8301169050919050565b7f45524332303a207472616e7366657220746f20746865207a65726f206164647260008201527f6573730000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f766520746f20746865207a65726f20616464726560008201527f7373000000000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206260008201527f616c616e63650000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e7366657220616d6f756e742065786365656473206160008201527f6c6c6f77616e6365000000000000000000000000000000000000000000000000602082015250565b7f45524332303a207472616e736665722066726f6d20746865207a65726f20616460008201527f6472657373000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a20617070726f76652066726f6d20746865207a65726f2061646460008201527f7265737300000000000000000000000000000000000000000000000000000000602082015250565b7f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f7760008201527f207a65726f000000000000000000000000000000000000000000000000000000602082015250565b61133a81610fdf565b811461134557600080fd5b50565b6113518161101d565b811461135c57600080fd5b5056fea2646970667358221220b3c129c93663de4578dfe5a3ceef494143e28bb9ac4461738559f65db42d2db064736f6c63430008040033", + "bytecode": "0x60806040523480156200001157600080fd5b5060405162000b5638038062000b568339810160408190526200003491620001db565b81516200004990600390602085019062000068565b5080516200005f90600490602084019062000068565b50505062000282565b828054620000769062000245565b90600052602060002090601f0160209004810192826200009a5760008555620000e5565b82601f10620000b557805160ff1916838001178555620000e5565b82800160010185558215620000e5579182015b82811115620000e5578251825591602001919060010190620000c8565b50620000f3929150620000f7565b5090565b5b80821115620000f35760008155600101620000f8565b634e487b7160e01b600052604160045260246000fd5b600082601f8301126200013657600080fd5b81516001600160401b03808211156200015357620001536200010e565b604051601f8301601f19908116603f011681019082821181831017156200017e576200017e6200010e565b816040528381526020925086838588010111156200019b57600080fd5b600091505b83821015620001bf5785820183015181830184015290820190620001a0565b83821115620001d15760008385830101525b9695505050505050565b60008060408385031215620001ef57600080fd5b82516001600160401b03808211156200020757600080fd5b620002158683870162000124565b935060208501519150808211156200022c57600080fd5b506200023b8582860162000124565b9150509250929050565b600181811c908216806200025a57607f821691505b602082108114156200027c57634e487b7160e01b600052602260045260246000fd5b50919050565b6108c480620002926000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101c6565b6040516100c39190610701565b60405180910390f35b6100df6100da366004610772565b610258565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f36600461079c565b61026e565b604051601281526020016100c3565b6100df610131366004610772565b61031d565b6100f36101443660046107d8565b6001600160a01b031660009081526020819052604090205490565b6100b6610359565b6100df610175366004610772565b610368565b6100df610188366004610772565b610401565b6100f361019b3660046107fa565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101d59061082d565b80601f01602080910402602001604051908101604052809291908181526020018280546102019061082d565b801561024e5780601f106102235761010080835404028352916020019161024e565b820191906000526020600020905b81548152906001019060200180831161023157829003601f168201915b5050505050905090565b600061026533848461040e565b50600192915050565b600061027b848484610532565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103055760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610312853385840361040e565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610265918590610354908690610868565b61040e565b6060600480546101d59061082d565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156103ea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016102fc565b6103f7338585840361040e565b5060019392505050565b6000610265338484610532565b6001600160a01b0383166104705760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016102fc565b6001600160a01b0382166104d15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016102fc565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105965760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016102fc565b6001600160a01b0382166105f85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016102fc565b6001600160a01b038316600090815260208190526040902054818110156106705760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016102fc565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906106a7908490610868565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106f391815260200190565b60405180910390a350505050565b600060208083528351808285015260005b8181101561072e57858101830151858201604001528201610712565b81811115610740576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461076d57600080fd5b919050565b6000806040838503121561078557600080fd5b61078e83610756565b946020939093013593505050565b6000806000606084860312156107b157600080fd5b6107ba84610756565b92506107c860208501610756565b9150604084013590509250925092565b6000602082840312156107ea57600080fd5b6107f382610756565b9392505050565b6000806040838503121561080d57600080fd5b61081683610756565b915061082460208401610756565b90509250929050565b600181811c9082168061084157607f821691505b6020821081141561086257634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561088957634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220200d63d7227620e0df6481e76a67dffb28ef35c0c3c55e1ee631b46bcb5e66c264736f6c634300080a0033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c80633950935111610071578063395093511461012357806370a082311461013657806395d89b411461015f578063a457c2d714610167578063a9059cbb1461017a578063dd62ed3e1461018d57600080fd5b806306fdde03146100ae578063095ea7b3146100cc57806318160ddd146100ef57806323b872dd14610101578063313ce56714610114575b600080fd5b6100b66101c6565b6040516100c39190610701565b60405180910390f35b6100df6100da366004610772565b610258565b60405190151581526020016100c3565b6002545b6040519081526020016100c3565b6100df61010f36600461079c565b61026e565b604051601281526020016100c3565b6100df610131366004610772565b61031d565b6100f36101443660046107d8565b6001600160a01b031660009081526020819052604090205490565b6100b6610359565b6100df610175366004610772565b610368565b6100df610188366004610772565b610401565b6100f361019b3660046107fa565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b6060600380546101d59061082d565b80601f01602080910402602001604051908101604052809291908181526020018280546102019061082d565b801561024e5780601f106102235761010080835404028352916020019161024e565b820191906000526020600020905b81548152906001019060200180831161023157829003601f168201915b5050505050905090565b600061026533848461040e565b50600192915050565b600061027b848484610532565b6001600160a01b0384166000908152600160209081526040808320338452909152902054828110156103055760405162461bcd60e51b815260206004820152602860248201527f45524332303a207472616e7366657220616d6f756e74206578636565647320616044820152676c6c6f77616e636560c01b60648201526084015b60405180910390fd5b610312853385840361040e565b506001949350505050565b3360008181526001602090815260408083206001600160a01b03871684529091528120549091610265918590610354908690610868565b61040e565b6060600480546101d59061082d565b3360009081526001602090815260408083206001600160a01b0386168452909152812054828110156103ea5760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b60648201526084016102fc565b6103f7338585840361040e565b5060019392505050565b6000610265338484610532565b6001600160a01b0383166104705760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b60648201526084016102fc565b6001600160a01b0382166104d15760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b60648201526084016102fc565b6001600160a01b0383811660008181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b6001600160a01b0383166105965760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b60648201526084016102fc565b6001600160a01b0382166105f85760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b60648201526084016102fc565b6001600160a01b038316600090815260208190526040902054818110156106705760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b60648201526084016102fc565b6001600160a01b038085166000908152602081905260408082208585039055918516815290812080548492906106a7908490610868565b92505081905550826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef846040516106f391815260200190565b60405180910390a350505050565b600060208083528351808285015260005b8181101561072e57858101830151858201604001528201610712565b81811115610740576000604083870101525b50601f01601f1916929092016040019392505050565b80356001600160a01b038116811461076d57600080fd5b919050565b6000806040838503121561078557600080fd5b61078e83610756565b946020939093013593505050565b6000806000606084860312156107b157600080fd5b6107ba84610756565b92506107c860208501610756565b9150604084013590509250925092565b6000602082840312156107ea57600080fd5b6107f382610756565b9392505050565b6000806040838503121561080d57600080fd5b61081683610756565b915061082460208401610756565b90509250929050565b600181811c9082168061084157607f821691505b6020821081141561086257634e487b7160e01b600052602260045260246000fd5b50919050565b6000821982111561088957634e487b7160e01b600052601160045260246000fd5b50019056fea2646970667358221220200d63d7227620e0df6481e76a67dffb28ef35c0c3c55e1ee631b46bcb5e66c264736f6c634300080a0033", "linkReferences": {}, "deployedLinkReferences": {} } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json index 8a9759bdf8..fd02eec0ea 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/6dfbc7f87ae3c2727d63a3fba8d02a41.json" + "buildInfo": "../../../../../build-info/b4e7ec2fd35748689d35a44cde08a2e7.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json index 5f2b42b50a..e4bc7fc277 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../../build-info/6dfbc7f87ae3c2727d63a3fba8d02a41.json" + "buildInfo": "../../../../../../build-info/b4e7ec2fd35748689d35a44cde08a2e7.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json index 7bbf60451f..bdcb1a5fdf 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/6dfbc7f87ae3c2727d63a3fba8d02a41.json" + "buildInfo": "../../../../build-info/b4e7ec2fd35748689d35a44cde08a2e7.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/math/SafeMath.sol/SafeMath.dbg.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/math/SafeMath.sol/SafeMath.dbg.json deleted file mode 100644 index bea78f6d8d..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/math/SafeMath.sol/SafeMath.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/10e5405221d21329b74f12bf00d0cd2d.json" -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/math/SafeMath.sol/SafeMath.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/math/SafeMath.sol/SafeMath.json deleted file mode 100644 index e1a95dfe90..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/math/SafeMath.sol/SafeMath.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "SafeMath", - "sourceName": "@openzeppelin/contracts/math/SafeMath.sol", - "abi": [], - "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212207ceb5b9e8bb631a9723802d1487d75b0f9db1e57e569e37561e9d35cd45a718c64736f6c63430006060033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea26469706673582212207ceb5b9e8bb631a9723802d1487d75b0f9db1e57e569e37561e9d35cd45a718c64736f6c63430006060033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json deleted file mode 100644 index e548d120de..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/10e5405221d21329b74f12bf00d0cd2d.json" -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json deleted file mode 100644 index f6b18c4e98..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.json +++ /dev/null @@ -1,297 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "ERC20", - "sourceName": "@openzeppelin/contracts/token/ERC20/ERC20.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "string", - "name": "name_", - "type": "string" - }, - { - "internalType": "string", - "name": "symbol_", - "type": "string" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x60806040523480156200001157600080fd5b5060405162000ca538038062000ca5833981810160405260408110156200003757600080fd5b81019080805160405193929190846401000000008211156200005857600080fd5b9083019060208201858111156200006e57600080fd5b82516401000000008111828201881017156200008957600080fd5b82525081516020918201929091019080838360005b83811015620000b85781810151838201526020016200009e565b50505050905090810190601f168015620000e65780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200010a57600080fd5b9083019060208201858111156200012057600080fd5b82516401000000008111828201881017156200013b57600080fd5b82525081516020918201929091019080838360005b838110156200016a57818101518382015260200162000150565b50505050905090810190601f168015620001985780820380516001836020036101000a031916815260200191505b5060405250508251620001b491506003906020850190620001e0565b508051620001ca906004906020840190620001e0565b50506005805460ff191660121790555062000285565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200022357805160ff191683800117855562000253565b8280016001018555821562000253579182015b828111156200025357825182559160200191906001019062000236565b506200026192915062000265565b5090565b6200028291905b808211156200026157600081556001016200026c565b90565b610a1080620002956000396000f3fe608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c36103ff565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610408565b6101736004803603602081101561021b57600080fd5b50356001600160a01b031661045c565b6100b6610477565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104d8565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610546565b610173600480360360408110156102a157600080fd5b506001600160a01b038135811691602001351661055a565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c610585565b8484610589565b50600192915050565b60025490565b600061037f848484610675565b6103f58461038b610585565b6103f085604051806060016040528060288152602001610945602891396001600160a01b038a166000908152600160205260408120906103c9610585565b6001600160a01b03168152602081019190915260400160002054919063ffffffff6107dc16565b610589565b5060019392505050565b60055460ff1690565b6000610363610415610585565b846103f08560016000610426610585565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61087316565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b60006103636104e5610585565b846103f0856040518060600160405280602581526020016109b6602591396001600061050f610585565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff6107dc16565b6000610363610553610585565b8484610675565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166105ce5760405162461bcd60e51b81526004018080602001828103825260248152602001806109926024913960400191505060405180910390fd5b6001600160a01b0382166106135760405162461bcd60e51b81526004018080602001828103825260228152602001806108fd6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106ba5760405162461bcd60e51b815260040180806020018281038252602581526020018061096d6025913960400191505060405180910390fd5b6001600160a01b0382166106ff5760405162461bcd60e51b81526004018080602001828103825260238152602001806108da6023913960400191505060405180910390fd5b61070a8383836108d4565b61074d8160405180606001604052806026815260200161091f602691396001600160a01b038616600090815260208190526040902054919063ffffffff6107dc16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610782908263ffffffff61087316565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000818484111561086b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610830578181015183820152602001610818565b50505050905090810190601f16801561085d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156108cd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122007c47290196c2ddfd0852f1dfc62deceb75163eca44542513eab3af1a7a838f964736f6c63430006060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100a95760003560e01c8063395093511161007157806339509351146101d957806370a082311461020557806395d89b411461022b578063a457c2d714610233578063a9059cbb1461025f578063dd62ed3e1461028b576100a9565b806306fdde03146100ae578063095ea7b31461012b57806318160ddd1461016b57806323b872dd14610185578063313ce567146101bb575b600080fd5b6100b66102b9565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100f05781810151838201526020016100d8565b50505050905090810190601f16801561011d5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101576004803603604081101561014157600080fd5b506001600160a01b03813516906020013561034f565b604080519115158252519081900360200190f35b61017361036c565b60408051918252519081900360200190f35b6101576004803603606081101561019b57600080fd5b506001600160a01b03813581169160208101359091169060400135610372565b6101c36103ff565b6040805160ff9092168252519081900360200190f35b610157600480360360408110156101ef57600080fd5b506001600160a01b038135169060200135610408565b6101736004803603602081101561021b57600080fd5b50356001600160a01b031661045c565b6100b6610477565b6101576004803603604081101561024957600080fd5b506001600160a01b0381351690602001356104d8565b6101576004803603604081101561027557600080fd5b506001600160a01b038135169060200135610546565b610173600480360360408110156102a157600080fd5b506001600160a01b038135811691602001351661055a565b60038054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b820191906000526020600020905b81548152906001019060200180831161032857829003601f168201915b5050505050905090565b600061036361035c610585565b8484610589565b50600192915050565b60025490565b600061037f848484610675565b6103f58461038b610585565b6103f085604051806060016040528060288152602001610945602891396001600160a01b038a166000908152600160205260408120906103c9610585565b6001600160a01b03168152602081019190915260400160002054919063ffffffff6107dc16565b610589565b5060019392505050565b60055460ff1690565b6000610363610415610585565b846103f08560016000610426610585565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff61087316565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156103455780601f1061031a57610100808354040283529160200191610345565b60006103636104e5610585565b846103f0856040518060600160405280602581526020016109b6602591396001600061050f610585565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff6107dc16565b6000610363610553610585565b8484610675565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166105ce5760405162461bcd60e51b81526004018080602001828103825260248152602001806109926024913960400191505060405180910390fd5b6001600160a01b0382166106135760405162461bcd60e51b81526004018080602001828103825260228152602001806108fd6022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166106ba5760405162461bcd60e51b815260040180806020018281038252602581526020018061096d6025913960400191505060405180910390fd5b6001600160a01b0382166106ff5760405162461bcd60e51b81526004018080602001828103825260238152602001806108da6023913960400191505060405180910390fd5b61070a8383836108d4565b61074d8160405180606001604052806026815260200161091f602691396001600160a01b038616600090815260208190526040902054919063ffffffff6107dc16565b6001600160a01b038085166000908152602081905260408082209390935590841681522054610782908263ffffffff61087316565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b6000818484111561086b5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b83811015610830578181015183820152602001610818565b50505050905090810190601f16801561085d5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6000828201838110156108cd576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa264697066735822122007c47290196c2ddfd0852f1dfc62deceb75163eca44542513eab3af1a7a838f964736f6c63430006060033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json deleted file mode 100644 index e548d120de..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/10e5405221d21329b74f12bf00d0cd2d.json" -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json deleted file mode 100644 index 663a02d9d8..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.json +++ /dev/null @@ -1,194 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "IERC20", - "sourceName": "@openzeppelin/contracts/token/ERC20/IERC20.sol", - "abi": [ - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/SafeERC20.sol/SafeERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/SafeERC20.sol/SafeERC20.dbg.json deleted file mode 100644 index e548d120de..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/SafeERC20.sol/SafeERC20.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/10e5405221d21329b74f12bf00d0cd2d.json" -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/SafeERC20.sol/SafeERC20.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/SafeERC20.sol/SafeERC20.json deleted file mode 100644 index 32820d7a1f..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/token/ERC20/SafeERC20.sol/SafeERC20.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "SafeERC20", - "sourceName": "@openzeppelin/contracts/token/ERC20/SafeERC20.sol", - "abi": [], - "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220a10ad72c41cead301751dbbfdbfa8dc0de387237baaadf00c593410d921ba53164736f6c63430006060033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220a10ad72c41cead301751dbbfdbfa8dc0de387237baaadf00c593410d921ba53164736f6c63430006060033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json deleted file mode 100644 index bea78f6d8d..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Address.sol/Address.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/10e5405221d21329b74f12bf00d0cd2d.json" -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Address.sol/Address.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Address.sol/Address.json deleted file mode 100644 index 3113f68c6d..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Address.sol/Address.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Address", - "sourceName": "@openzeppelin/contracts/utils/Address.sol", - "abi": [], - "bytecode": "0x60566023600b82828239805160001a607314601657fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220bf51151e2a4e160194baa49fc39a27bad1253743e398fefe6fb6935ec7d37a5e64736f6c63430006060033", - "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fdfea2646970667358221220bf51151e2a4e160194baa49fc39a27bad1253743e398fefe6fb6935ec7d37a5e64736f6c63430006060033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json deleted file mode 100644 index bea78f6d8d..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/10e5405221d21329b74f12bf00d0cd2d.json" -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Context.sol/Context.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Context.sol/Context.json deleted file mode 100644 index 8fe86fc78f..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/Context.sol/Context.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Context", - "sourceName": "@openzeppelin/contracts/utils/Context.sol", - "abi": [], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json deleted file mode 100644 index bea78f6d8d..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/ReentrancyGuard.sol/ReentrancyGuard.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/10e5405221d21329b74f12bf00d0cd2d.json" -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/ReentrancyGuard.sol/ReentrancyGuard.json b/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/ReentrancyGuard.sol/ReentrancyGuard.json deleted file mode 100644 index 528717537e..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/@openzeppelin/contracts/utils/ReentrancyGuard.sol/ReentrancyGuard.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "ReentrancyGuard", - "sourceName": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", - "abi": [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - } - ], - "bytecode": "0x", - "deployedBytecode": "0x", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/BandwidthGenerator.sol/BandwidthGenerator.json b/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/BandwidthGenerator.sol/BandwidthGenerator.json deleted file mode 100644 index 5dcfb9588c..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/BandwidthGenerator.sol/BandwidthGenerator.json +++ /dev/null @@ -1,222 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "BandwidthGenerator", - "sourceName": "contracts/BandwidthGenerator.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "contract CosmosERC20", - "name": "_erc20", - "type": "address" - }, - { - "internalType": "contract Gravity", - "name": "_gravityBridge", - "type": "address" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "Bandwidth", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "uint256", - "name": "VerificationKey", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "SignedVerificationKey", - "type": "bytes" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "CosmosRecipient", - "type": "bytes32" - } - ], - "name": "BBCredentialPurchased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "previousOwner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "OwnershipTransferred", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "NewBytesPerToken", - "type": "uint256" - } - ], - "name": "RatioChanged", - "type": "event" - }, - { - "inputs": [], - "name": "BytesPerToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "bandwidthFromToken", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_newBytesPerTokenAmount", - "type": "uint256" - } - ], - "name": "changeRatio", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "erc20", - "outputs": [ - { - "internalType": "contract CosmosERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_verificationKey", - "type": "uint256" - }, - { - "internalType": "bytes", - "name": "_signedVerificationKey", - "type": "bytes" - }, - { - "internalType": "bytes32", - "name": "_cosmosRecipient", - "type": "bytes32" - } - ], - "name": "generateBasicBandwidthCredential", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "gravityBridge", - "outputs": [ - { - "internalType": "contract Gravity", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x608060405234801561001057600080fd5b50604051610b18380380610b188339818101604052604081101561003357600080fd5b508051602090910151600061004f6001600160e01b0361015c16565b600080546001600160a01b0319166001600160a01b0383169081178255604051929350917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a3506001600160a01b0382166100de5760405162461bcd60e51b8152600401808060200182810382526030815260200180610ae86030913960400191505060405180910390fd5b6001600160a01b0381166101235760405162461bcd60e51b8152600401808060200182810382526039815260200180610aaf6039913960400191505060405180910390fd5b600180546001600160a01b039384166001600160a01b031991821617909155600280549290931691161790556340000000600355610160565b3390565b6109408061016f6000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c80639e0dda8b116100665780639e0dda8b146101825780639fbb65e9146101b1578063a4da2d02146101b9578063f2fde38b146101c1578063f6a33253146101e757610093565b8063715018a61461009857806373f48677146100a2578063785e9e86146101565780638da5cb5b1461017a575b600080fd5b6100a0610204565b005b6100a0600480360360808110156100b857600080fd5b8135916020810135918101906060810160408201356401000000008111156100df57600080fd5b8201836020820111156100f157600080fd5b8035906020019184600183028401116401000000008311171561011357600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506102c2915050565b61015e61053b565b604080516001600160a01b039092168252519081900360200190f35b61015e61054a565b61019f6004803603602081101561019857600080fd5b5035610559565b60408051918252519081900360200190f35b61019f610592565b61015e610598565b6100a0600480360360208110156101d757600080fd5b50356001600160a01b03166105a7565b6100a0600480360360208110156101fd57600080fd5b50356106bb565b61020c61079e565b6001600160a01b031661021d61054a565b6001600160a01b031614610278576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b81516040146103025760405162461bcd60e51b81526004018080602001828103825260338152602001806108d86033913960400191505060405180910390fd5b600154604080516323b872dd60e01b81523360048201523060248201526044810187905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561035c57600080fd5b505af1158015610370573d6000803e3d6000fd5b505050506040513d602081101561038657600080fd5b50506001546002546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018890529051919092169163095ea7b39160448083019260209291908290030181600087803b1580156103e157600080fd5b505af11580156103f5573d6000803e3d6000fd5b505050506040513d602081101561040b57600080fd5b505060025460015460408051631ffbe7f960e01b81526001600160a01b039283166004820152602481018590526044810188905290519190921691631ffbe7f991606480830192600092919082900301818387803b15801561046c57600080fd5b505af1158015610480573d6000803e3d6000fd5b50505050600061048f85610559565b905081847fc300d88f6eea8461741d440d04aa6147e081770af25e30862f6cc38d1033b9d183866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156104f95781810151838201526020016104e1565b50505050905090810190601f1680156105265780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35050505050565b6001546001600160a01b031681565b6000546001600160a01b031690565b600080610571600354846107a290919063ffffffff16565b905061058b81670de0b6b3a764000063ffffffff61080416565b9392505050565b60035481565b6002546001600160a01b031681565b6105af61079e565b6001600160a01b03166105c061054a565b6001600160a01b03161461061b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166106605760405162461bcd60e51b81526004018080602001828103825260268152602001806108916026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6106c361079e565b6001600160a01b03166106d461054a565b6001600160a01b03161461072f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b8061076b5760405162461bcd60e51b815260040180806020018281038252602581526020018061086c6025913960400191505060405180910390fd5b600381905560405181907fe200219383a2dbe79fad4e1549a81b6057429299f33583641c5fdddcdc0b379790600090a250565b3390565b6000826107b1575060006107fe565b828202828482816107be57fe5b04146107fb5760405162461bcd60e51b81526004018080602001828103825260218152602001806108b76021913960400191505060405180910390fd5b90505b92915050565b600080821161085a576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161086357fe5b04939250505056fe42616e64776964746847656e657261746f723a2070726963652063616e6e6f7420626520304f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7742616e64776964746847656e657261746f723a205369676e617475726520646f65736e27742068617665203634206279746573a2646970667358221220f91ec99d2617d86852e5a7b9e83177368e551623bc5a0faa1daa4f51dfd32a2764736f6c6343000606003342616e64776964746847656e657261746f723a20677261766974792062726964676520616464726573732063616e6e6f74206265206e756c6c42616e64776964746847656e657261746f723a20657263323020616464726573732063616e6e6f74206265206e756c6c", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100935760003560e01c80639e0dda8b116100665780639e0dda8b146101825780639fbb65e9146101b1578063a4da2d02146101b9578063f2fde38b146101c1578063f6a33253146101e757610093565b8063715018a61461009857806373f48677146100a2578063785e9e86146101565780638da5cb5b1461017a575b600080fd5b6100a0610204565b005b6100a0600480360360808110156100b857600080fd5b8135916020810135918101906060810160408201356401000000008111156100df57600080fd5b8201836020820111156100f157600080fd5b8035906020019184600183028401116401000000008311171561011357600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955050913592506102c2915050565b61015e61053b565b604080516001600160a01b039092168252519081900360200190f35b61015e61054a565b61019f6004803603602081101561019857600080fd5b5035610559565b60408051918252519081900360200190f35b61019f610592565b61015e610598565b6100a0600480360360208110156101d757600080fd5b50356001600160a01b03166105a7565b6100a0600480360360208110156101fd57600080fd5b50356106bb565b61020c61079e565b6001600160a01b031661021d61054a565b6001600160a01b031614610278576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b600080546040516001600160a01b03909116907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600080546001600160a01b0319169055565b81516040146103025760405162461bcd60e51b81526004018080602001828103825260338152602001806108d86033913960400191505060405180910390fd5b600154604080516323b872dd60e01b81523360048201523060248201526044810187905290516001600160a01b03909216916323b872dd916064808201926020929091908290030181600087803b15801561035c57600080fd5b505af1158015610370573d6000803e3d6000fd5b505050506040513d602081101561038657600080fd5b50506001546002546040805163095ea7b360e01b81526001600160a01b039283166004820152602481018890529051919092169163095ea7b39160448083019260209291908290030181600087803b1580156103e157600080fd5b505af11580156103f5573d6000803e3d6000fd5b505050506040513d602081101561040b57600080fd5b505060025460015460408051631ffbe7f960e01b81526001600160a01b039283166004820152602481018590526044810188905290519190921691631ffbe7f991606480830192600092919082900301818387803b15801561046c57600080fd5b505af1158015610480573d6000803e3d6000fd5b50505050600061048f85610559565b905081847fc300d88f6eea8461741d440d04aa6147e081770af25e30862f6cc38d1033b9d183866040518083815260200180602001828103825283818151815260200191508051906020019080838360005b838110156104f95781810151838201526020016104e1565b50505050905090810190601f1680156105265780820380516001836020036101000a031916815260200191505b50935050505060405180910390a35050505050565b6001546001600160a01b031681565b6000546001600160a01b031690565b600080610571600354846107a290919063ffffffff16565b905061058b81670de0b6b3a764000063ffffffff61080416565b9392505050565b60035481565b6002546001600160a01b031681565b6105af61079e565b6001600160a01b03166105c061054a565b6001600160a01b03161461061b576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b6001600160a01b0381166106605760405162461bcd60e51b81526004018080602001828103825260268152602001806108916026913960400191505060405180910390fd5b600080546040516001600160a01b03808516939216917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091a3600080546001600160a01b0319166001600160a01b0392909216919091179055565b6106c361079e565b6001600160a01b03166106d461054a565b6001600160a01b03161461072f576040805162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015290519081900360640190fd5b8061076b5760405162461bcd60e51b815260040180806020018281038252602581526020018061086c6025913960400191505060405180910390fd5b600381905560405181907fe200219383a2dbe79fad4e1549a81b6057429299f33583641c5fdddcdc0b379790600090a250565b3390565b6000826107b1575060006107fe565b828202828482816107be57fe5b04146107fb5760405162461bcd60e51b81526004018080602001828103825260218152602001806108b76021913960400191505060405180910390fd5b90505b92915050565b600080821161085a576040805162461bcd60e51b815260206004820152601a60248201527f536166654d6174683a206469766973696f6e206279207a65726f000000000000604482015290519081900360640190fd5b81838161086357fe5b04939250505056fe42616e64776964746847656e657261746f723a2070726963652063616e6e6f7420626520304f776e61626c653a206e6577206f776e657220697320746865207a65726f2061646472657373536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7742616e64776964746847656e657261746f723a205369676e617475726520646f65736e27742068617665203634206279746573a2646970667358221220f91ec99d2617d86852e5a7b9e83177368e551623bc5a0faa1daa4f51dfd32a2764736f6c63430006060033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/CosmosToken.sol/CosmosERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/CosmosToken.sol/CosmosERC20.dbg.json deleted file mode 100644 index 24a82a1032..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/CosmosToken.sol/CosmosERC20.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/10e5405221d21329b74f12bf00d0cd2d.json" -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/CosmosToken.sol/CosmosERC20.json b/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/CosmosToken.sol/CosmosERC20.json deleted file mode 100644 index fa39aa04ea..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/CosmosToken.sol/CosmosERC20.json +++ /dev/null @@ -1,325 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "CosmosERC20", - "sourceName": "contracts/CosmosToken.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "address", - "name": "_gravityAddress", - "type": "address" - }, - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "string", - "name": "_symbol", - "type": "string" - }, - { - "internalType": "uint8", - "name": "_decimals", - "type": "uint8" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Approval", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "from", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "to", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "Transfer", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" - }, - { - "internalType": "address", - "name": "spender", - "type": "address" - } - ], - "name": "allowance", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "approve", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "balanceOf", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "decimals", - "outputs": [ - { - "internalType": "uint8", - "name": "", - "type": "uint8" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "subtractedValue", - "type": "uint256" - } - ], - "name": "decreaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "spender", - "type": "address" - }, - { - "internalType": "uint256", - "name": "addedValue", - "type": "uint256" - } - ], - "name": "increaseAllowance", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_to", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "mintForUnitTesting", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "symbol", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "totalSupply", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transfer", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "sender", - "type": "address" - }, - { - "internalType": "address", - "name": "recipient", - "type": "address" - }, - { - "internalType": "uint256", - "name": "amount", - "type": "uint256" - } - ], - "name": "transferFrom", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x6080604052600160ff1b6006553480156200001957600080fd5b5060405162000fc138038062000fc1833981810160405260808110156200003f57600080fd5b8151602083018051604051929492938301929190846401000000008211156200006757600080fd5b9083019060208201858111156200007d57600080fd5b82516401000000008111828201881017156200009857600080fd5b82525081516020918201929091019080838360005b83811015620000c7578181015183820152602001620000ad565b50505050905090810190601f168015620000f55780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011957600080fd5b9083019060208201858111156200012f57600080fd5b82516401000000008111828201881017156200014a57600080fd5b82525081516020918201929091019080838360005b83811015620001795781810151838201526020016200015f565b50505050905090810190601f168015620001a75780820380516001836020036101000a031916815260200191505b5060405260209081015185519093508592508491620001cc91600391850190620003b9565b508051620001e2906004906020840190620003b9565b50506005805460ff191660121790555062000206816001600160e01b036200022416565b6200021a846006546200023a60201b60201c565b505050506200045e565b6005805460ff191660ff92909216919091179055565b6001600160a01b03821662000296576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b620002ad600083836001600160e01b036200035216565b620002c9816002546200035760201b620009b61790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620002fc918390620009b662000357821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b600082820183811015620003b2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620003fc57805160ff19168380011785556200042c565b828001600101855582156200042c579182015b828111156200042c5782518255916020019190600101906200040f565b506200043a9291506200043e565b5090565b6200045b91905b808211156200043a576000815560010162000445565b90565b610b53806200046e6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80633950935111610071578063395093511461021257806370a082311461023e57806395d89b4114610264578063a457c2d71461026c578063a9059cbb14610298578063dd62ed3e146102c4576100b4565b806306fdde03146100b9578063095ea7b31461013657806318160ddd1461017657806323b872dd146101905780632ebdf54d146101c6578063313ce567146101f4575b600080fd5b6100c16102f2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fb5781810151838201526020016100e3565b50505050905090810190601f1680156101285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101626004803603604081101561014c57600080fd5b506001600160a01b038135169060200135610388565b604080519115158252519081900360200190f35b61017e6103a5565b60408051918252519081900360200190f35b610162600480360360608110156101a657600080fd5b506001600160a01b038135811691602081013590911690604001356103ab565b6101f2600480360360408110156101dc57600080fd5b506001600160a01b038135169060200135610438565b005b6101fc610446565b6040805160ff9092168252519081900360200190f35b6101626004803603604081101561022857600080fd5b506001600160a01b03813516906020013561044f565b61017e6004803603602081101561025457600080fd5b50356001600160a01b03166104a3565b6100c16104be565b6101626004803603604081101561028257600080fd5b506001600160a01b03813516906020013561051f565b610162600480360360408110156102ae57600080fd5b506001600160a01b03813516906020013561058d565b61017e600480360360408110156102da57600080fd5b506001600160a01b03813581169160200135166105a1565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561037e5780601f106103535761010080835404028352916020019161037e565b820191906000526020600020905b81548152906001019060200180831161036157829003601f168201915b5050505050905090565b600061039c6103956105cc565b84846105d0565b50600192915050565b60025490565b60006103b88484846106bc565b61042e846103c46105cc565b61042985604051806060016040528060288152602001610a88602891396001600160a01b038a166000908152600160205260408120906104026105cc565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61082316565b6105d0565b5060019392505050565b61044282826108ba565b5050565b60055460ff1690565b600061039c61045c6105cc565b84610429856001600061046d6105cc565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff6109b616565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561037e5780601f106103535761010080835404028352916020019161037e565b600061039c61052c6105cc565b8461042985604051806060016040528060258152602001610af960259139600160006105566105cc565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61082316565b600061039c61059a6105cc565b84846106bc565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166106155760405162461bcd60e51b8152600401808060200182810382526024815260200180610ad56024913960400191505060405180910390fd5b6001600160a01b03821661065a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610a406022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166107015760405162461bcd60e51b8152600401808060200182810382526025815260200180610ab06025913960400191505060405180910390fd5b6001600160a01b0382166107465760405162461bcd60e51b8152600401808060200182810382526023815260200180610a1d6023913960400191505060405180910390fd5b610751838383610a17565b61079481604051806060016040528060268152602001610a62602691396001600160a01b038616600090815260208190526040902054919063ffffffff61082316565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546107c9908263ffffffff6109b616565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156108b25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561087757818101518382015260200161085f565b50505050905090810190601f1680156108a45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216610915576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61092160008383610a17565b600254610934908263ffffffff6109b616565b6002556001600160a01b038216600090815260208190526040902054610960908263ffffffff6109b616565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600082820183811015610a10576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220465410ed025b5712ee2eaddad7a20856f64710d3b57e1ff91396130750dfabd564736f6c63430006060033", - "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100b45760003560e01c80633950935111610071578063395093511461021257806370a082311461023e57806395d89b4114610264578063a457c2d71461026c578063a9059cbb14610298578063dd62ed3e146102c4576100b4565b806306fdde03146100b9578063095ea7b31461013657806318160ddd1461017657806323b872dd146101905780632ebdf54d146101c6578063313ce567146101f4575b600080fd5b6100c16102f2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fb5781810151838201526020016100e3565b50505050905090810190601f1680156101285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101626004803603604081101561014c57600080fd5b506001600160a01b038135169060200135610388565b604080519115158252519081900360200190f35b61017e6103a5565b60408051918252519081900360200190f35b610162600480360360608110156101a657600080fd5b506001600160a01b038135811691602081013590911690604001356103ab565b6101f2600480360360408110156101dc57600080fd5b506001600160a01b038135169060200135610438565b005b6101fc610446565b6040805160ff9092168252519081900360200190f35b6101626004803603604081101561022857600080fd5b506001600160a01b03813516906020013561044f565b61017e6004803603602081101561025457600080fd5b50356001600160a01b03166104a3565b6100c16104be565b6101626004803603604081101561028257600080fd5b506001600160a01b03813516906020013561051f565b610162600480360360408110156102ae57600080fd5b506001600160a01b03813516906020013561058d565b61017e600480360360408110156102da57600080fd5b506001600160a01b03813581169160200135166105a1565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561037e5780601f106103535761010080835404028352916020019161037e565b820191906000526020600020905b81548152906001019060200180831161036157829003601f168201915b5050505050905090565b600061039c6103956105cc565b84846105d0565b50600192915050565b60025490565b60006103b88484846106bc565b61042e846103c46105cc565b61042985604051806060016040528060288152602001610a88602891396001600160a01b038a166000908152600160205260408120906104026105cc565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61082316565b6105d0565b5060019392505050565b61044282826108ba565b5050565b60055460ff1690565b600061039c61045c6105cc565b84610429856001600061046d6105cc565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff6109b616565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561037e5780601f106103535761010080835404028352916020019161037e565b600061039c61052c6105cc565b8461042985604051806060016040528060258152602001610af960259139600160006105566105cc565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61082316565b600061039c61059a6105cc565b84846106bc565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166106155760405162461bcd60e51b8152600401808060200182810382526024815260200180610ad56024913960400191505060405180910390fd5b6001600160a01b03821661065a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610a406022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166107015760405162461bcd60e51b8152600401808060200182810382526025815260200180610ab06025913960400191505060405180910390fd5b6001600160a01b0382166107465760405162461bcd60e51b8152600401808060200182810382526023815260200180610a1d6023913960400191505060405180910390fd5b610751838383610a17565b61079481604051806060016040528060268152602001610a62602691396001600160a01b038616600090815260208190526040902054919063ffffffff61082316565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546107c9908263ffffffff6109b616565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156108b25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561087757818101518382015260200161085f565b50505050905090810190601f1680156108a45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216610915576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61092160008383610a17565b600254610934908263ffffffff6109b616565b6002556001600160a01b038216600090815260208190526040902054610960908263ffffffff6109b616565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600082820183811015610a10576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220465410ed025b5712ee2eaddad7a20856f64710d3b57e1ff91396130750dfabd564736f6c63430006060033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/Gravity.sol/Gravity.dbg.json b/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/Gravity.sol/Gravity.dbg.json deleted file mode 100644 index 24a82a1032..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/Gravity.sol/Gravity.dbg.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "_format": "hh-sol-dbg-1", - "buildInfo": "../../build-info/10e5405221d21329b74f12bf00d0cd2d.json" -} diff --git a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/Gravity.sol/Gravity.json b/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/Gravity.sol/Gravity.json deleted file mode 100644 index 109851c28c..0000000000 --- a/contracts/basic-bandwidth-generation/artifacts/contracts/contracts/Gravity.sol/Gravity.json +++ /dev/null @@ -1,678 +0,0 @@ -{ - "_format": "hh-sol-artifact-1", - "contractName": "Gravity", - "sourceName": "contracts/Gravity.sol", - "abi": [ - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_gravityId", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "_powerThreshold", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_validators", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_powers", - "type": "uint256[]" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "string", - "name": "_cosmosDenom", - "type": "string" - }, - { - "indexed": true, - "internalType": "address", - "name": "_tokenContract", - "type": "address" - }, - { - "indexed": false, - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "indexed": false, - "internalType": "string", - "name": "_symbol", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint8", - "name": "_decimals", - "type": "uint8" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_eventNonce", - "type": "uint256" - } - ], - "name": "ERC20DeployedEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "bytes32", - "name": "_invalidationId", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_invalidationNonce", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes", - "name": "_returnData", - "type": "bytes" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_eventNonce", - "type": "uint256" - } - ], - "name": "LogicCallEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "_tokenContract", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "_sender", - "type": "address" - }, - { - "indexed": true, - "internalType": "bytes32", - "name": "_destination", - "type": "bytes32" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_eventNonce", - "type": "uint256" - } - ], - "name": "SendToCosmosEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "_batchNonce", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "_token", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_eventNonce", - "type": "uint256" - } - ], - "name": "TransactionBatchExecutedEvent", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "_newValsetNonce", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "_eventNonce", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "address[]", - "name": "_validators", - "type": "address[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "_powers", - "type": "uint256[]" - } - ], - "name": "ValsetUpdatedEvent", - "type": "event" - }, - { - "inputs": [ - { - "internalType": "string", - "name": "_cosmosDenom", - "type": "string" - }, - { - "internalType": "string", - "name": "_name", - "type": "string" - }, - { - "internalType": "string", - "name": "_symbol", - "type": "string" - }, - { - "internalType": "uint8", - "name": "_decimals", - "type": "uint8" - } - ], - "name": "deployERC20", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_erc20Address", - "type": "address" - } - ], - "name": "lastBatchNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "_invalidation_id", - "type": "bytes32" - } - ], - "name": "lastLogicCallNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_tokenContract", - "type": "address" - }, - { - "internalType": "bytes32", - "name": "_destination", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "_amount", - "type": "uint256" - } - ], - "name": "sendToCosmos", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "state_gravityId", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "state_invalidationMapping", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "state_lastBatchNonces", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "state_lastEventNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "state_lastValsetCheckpoint", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "state_lastValsetNonce", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "state_powerThreshold", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_currentValidators", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_currentPowers", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_currentValsetNonce", - "type": "uint256" - }, - { - "internalType": "uint8[]", - "name": "_v", - "type": "uint8[]" - }, - { - "internalType": "bytes32[]", - "name": "_r", - "type": "bytes32[]" - }, - { - "internalType": "bytes32[]", - "name": "_s", - "type": "bytes32[]" - }, - { - "internalType": "uint256[]", - "name": "_amounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "_destinations", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_fees", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_batchNonce", - "type": "uint256" - }, - { - "internalType": "address", - "name": "_tokenContract", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_batchTimeout", - "type": "uint256" - } - ], - "name": "submitBatch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_currentValidators", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_currentPowers", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_currentValsetNonce", - "type": "uint256" - }, - { - "internalType": "uint8[]", - "name": "_v", - "type": "uint8[]" - }, - { - "internalType": "bytes32[]", - "name": "_r", - "type": "bytes32[]" - }, - { - "internalType": "bytes32[]", - "name": "_s", - "type": "bytes32[]" - }, - { - "components": [ - { - "internalType": "uint256[]", - "name": "transferAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "transferTokenContracts", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "feeAmounts", - "type": "uint256[]" - }, - { - "internalType": "address[]", - "name": "feeTokenContracts", - "type": "address[]" - }, - { - "internalType": "address", - "name": "logicContractAddress", - "type": "address" - }, - { - "internalType": "bytes", - "name": "payload", - "type": "bytes" - }, - { - "internalType": "uint256", - "name": "timeOut", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "invalidationId", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "invalidationNonce", - "type": "uint256" - } - ], - "internalType": "struct LogicCallArgs", - "name": "_args", - "type": "tuple" - } - ], - "name": "submitLogicCall", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_currentValidators", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_currentPowers", - "type": "uint256[]" - }, - { - "internalType": "uint8[]", - "name": "_v", - "type": "uint8[]" - }, - { - "internalType": "bytes32[]", - "name": "_r", - "type": "bytes32[]" - }, - { - "internalType": "bytes32[]", - "name": "_s", - "type": "bytes32[]" - }, - { - "internalType": "bytes32", - "name": "_theHash", - "type": "bytes32" - }, - { - "internalType": "uint256", - "name": "_powerThreshold", - "type": "uint256" - } - ], - "name": "testCheckValidatorSignatures", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_validators", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_powers", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_valsetNonce", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "_gravityId", - "type": "bytes32" - } - ], - "name": "testMakeCheckpoint", - "outputs": [], - "stateMutability": "pure", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address[]", - "name": "_newValidators", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_newPowers", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_newValsetNonce", - "type": "uint256" - }, - { - "internalType": "address[]", - "name": "_currentValidators", - "type": "address[]" - }, - { - "internalType": "uint256[]", - "name": "_currentPowers", - "type": "uint256[]" - }, - { - "internalType": "uint256", - "name": "_currentValsetNonce", - "type": "uint256" - }, - { - "internalType": "uint8[]", - "name": "_v", - "type": "uint8[]" - }, - { - "internalType": "bytes32[]", - "name": "_r", - "type": "bytes32[]" - }, - { - "internalType": "bytes32[]", - "name": "_s", - "type": "bytes32[]" - } - ], - "name": "updateValset", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ], - "bytecode": "0x6080604052600060045560016005553480156200001b57600080fd5b50604051620038c2380380620038c28339810160408190526200003e9162000233565b60016000558051825114620000705760405162461bcd60e51b8152600401620000679062000431565b60405180910390fd5b6000805b8251811015620000af578281815181106200008b57fe5b60200260200101518201915084821115620000a657620000af565b60010162000074565b50838111620000d25760405162461bcd60e51b81526004016200006790620003d4565b6000620000eb848483896001600160e01b036200014d16565b60068790556007869055600181905560045460055460405192935090917fb119f1f36224601586b5037da909ecf37e83864dddea5d32ad4e32ac1d97e62b9162000139918890889062000468565b60405180910390a2505050505050620004e8565b6040516000906918da1958dadc1bda5b9d60b21b9082906200017c908590849088908b908b906020016200038d565b60408051808303601f190181529190528051602090910120979650505050505050565b80516001600160a01b0381168114620001b757600080fd5b92915050565b600082601f830112620001ce578081fd5b8151620001e5620001df82620004c8565b620004a1565b8181529150602080830190848101818402860182018710156200020757600080fd5b60005b8481101562000228578151845292820192908201906001016200020a565b505050505092915050565b6000806000806080858703121562000249578384fd5b845160208087015160408801519296509450906001600160401b038082111562000271578485fd5b81880189601f82011262000283578586fd5b8051925062000296620001df84620004c8565b83815284810190828601868602840187018d1015620002b3578889fd5b8893505b85841015620002e157620002cc8d826200019f565b835260019390930192918601918601620002b7565b5060608b01519097509450505080831115620002fb578384fd5b50506200030b87828801620001bd565b91505092959194509250565b6000815180845260208085019450808401835b83811015620003515781516001600160a01b0316875295820195908201906001016200032a565b509495945050505050565b6000815180845260208085019450808401835b8381101562000351578151875295820195908201906001016200036f565b600086825285602083015284604083015260a06060830152620003b460a083018562000317565b8281036080840152620003c881856200035c565b98975050505050505050565b6020808252603c908201527f5375626d69747465642076616c696461746f7220736574207369676e6174757260408201527f657320646f206e6f74206861766520656e6f75676820706f7765722e00000000606082015260800190565b6020808252601f908201527f4d616c666f726d65642063757272656e742076616c696461746f722073657400604082015260600190565b60008482526060602083015262000483606083018562000317565b82810360408401526200049781856200035c565b9695505050505050565b6040518181016001600160401b0381118282101715620004c057600080fd5b604052919050565b60006001600160401b03821115620004de578081fd5b5060209081020190565b6133ca80620004f86000396000f3fe60806040523480156200001157600080fd5b5060043610620001185760003560e01c8063c227c30b11620000a5578063e3cb9f62116200006f578063e3cb9f621462000224578063e5a2b5d2146200023b578063f2b533071462000245578063f7955637146200024f5762000118565b8063c227c30b14620001c8578063c9d194d514620001df578063db7c4e5714620001f6578063df97174b146200020d5762000118565b80637dfb6f8611620000e75780637dfb6f86146200018657806383b435db146200019d578063b56561fe14620001b4578063bdda81d414620001be5762000118565b8063011b2174146200011d5780630c246c82146200014c5780631ffbe7f9146200016557806373b20547146200017c575b600080fd5b620001346200012e366004620013ef565b62000266565b60405162000143919062001c0d565b60405180910390f35b620001636200015d36600462001830565b62000281565b005b62000163620001763660046200140d565b620005ce565b6200013462000684565b6200013462000197366004620019d4565b6200068a565b62000163620001ae36600462001678565b6200069c565b6200013462000968565b620001346200096e565b62000163620001d93660046200193b565b62000974565b62000134620001f0366004620019d4565b62000989565b62000163620002073660046200144e565b6200099b565b620001346200021e366004620013ef565b620009b5565b62000163620002353660046200153c565b620009c7565b6200013462000b53565b6200013462000b59565b6200016362000260366004620019ed565b62000b5f565b6001600160a01b031660009081526002602052604090205490565b60026000541415620002b05760405162461bcd60e51b8152600401620002a790620022df565b60405180910390fd5b600260005560c08101514310620002db5760405162461bcd60e51b8152600401620002a79062001fec565b61010081015160e082015160009081526003602052604090205410620003155760405162461bcd60e51b8152600401620002a79062001f58565b8551875114801562000328575083518751145b801562000336575082518751145b801562000344575081518751145b620003635760405162461bcd60e51b8152600401620002a790620022a8565b6001546200037688888860065462000c11565b14620003965760405162461bcd60e51b8152600401620002a79062001e6e565b60208101515181515114620003bf5760405162461bcd60e51b8152600401620002a790620020f5565b80606001515181604001515114620003eb5760405162461bcd60e51b8152600401620002a79062001e3e565b6000600654681b1bd9da58d0d85b1b60ba1b836000015184602001518560400151866060015187608001518860a001518960c001518a60e001518b6101000151604051602001620004479b9a9998979695949392919062001c5d565b6040516020818303038152906040528051906020012090506200047288888787878660075462000c63565b61010082015160e08301516000908152600360205260408120919091555b825151811015620004f857620004ef836080015184600001518381518110620004b557fe5b602002602001015185602001518481518110620004ce57fe5b60200260200101516001600160a01b031662000d6d9092919063ffffffff16565b60010162000490565b5060606200050f83608001518460a0015162000dcc565b905060005b8360400151518110156200055a576200055133856040015183815181106200053857fe5b602002602001015186606001518481518110620004ce57fe5b60010162000514565b506005546200057190600163ffffffff62000e1916565b600581905560e08401516101008501516040517f7c2bb24f8e1b3725cb613d7f11ef97d9745cc97a0e40f730621c052d684077a193620005b693929186919062001d83565b60405180910390a15050600160005550505050505050565b60026000541415620005f45760405162461bcd60e51b8152600401620002a790620022df565b6002600055620006166001600160a01b03841633308463ffffffff62000e4116565b6005546200062c90600163ffffffff62000e1916565b6005819055604051839133916001600160a01b038716917fd7767894d73c589daeca9643f445f03d7be61aad2950c117e7cbff4176fca7e491620006729187916200234f565b60405180910390a45050600160005550565b60055481565b60036020526000908152604090205481565b60026000541415620006c25760405162461bcd60e51b8152600401620002a790620022df565b600260008181556001600160a01b038416815260209190915260409020548311620007015760405162461bcd60e51b8152600401620002a79062001ecb565b804310620007235760405162461bcd60e51b8152600401620002a79062002098565b8a518c5114801562000736575088518c51145b801562000744575087518c51145b801562000752575086518c51145b620007715760405162461bcd60e51b8152600401620002a790620022a8565b600154620007848d8d8d60065462000c11565b14620007a45760405162461bcd60e51b8152600401620002a79062001e6e565b84518651148015620007b7575083518651145b620007d65760405162461bcd60e51b8152600401620002a79062001f21565b620008348c8c8b8b8b6006546f0e8e4c2dce6c2c6e8d2dedc84c2e8c6d60831b8d8d8d8d8d8d6040516020016200081598979695949392919062001d0c565b6040516020818303038152906040528051906020012060075462000c63565b6001600160a01b0382166000908152600260205260408120849055805b8751811015620008d757620008a38782815181106200086c57fe5b60200260200101518983815181106200088157fe5b6020026020010151866001600160a01b031662000d6d9092919063ffffffff16565b620008cc868281518110620008b457fe5b60200260200101518362000e1990919063ffffffff16565b915060010162000851565b50620008f46001600160a01b038416338363ffffffff62000d6d16565b506005546200090b90600163ffffffff62000e1916565b60058190556040516001600160a01b0384169185917f02c7e81975f8edb86e2a0c038b7b86a49c744236abf0f6177ff5afc6986ab708916200094d9162001c0d565b60405180910390a35050600160005550505050505050505050565b60045481565b60065481565b620009828484848462000c11565b5050505050565b60009081526003602052604090205490565b620009ac8787878787878762000c63565b50505050505050565b60026020526000908152604090205481565b60026000541415620009ed5760405162461bcd60e51b8152600401620002a790620022df565b600260005583871162000a145760405162461bcd60e51b8152600401620002a790620021ca565b875189511462000a385760405162461bcd60e51b8152600401620002a79062002136565b8451865114801562000a4b575082518651145b801562000a59575081518651145b801562000a67575080518651145b62000a865760405162461bcd60e51b8152600401620002a790620022a8565b60015462000a9987878760065462000c11565b1462000ab95760405162461bcd60e51b8152600401620002a79062001e6e565b600062000acb8a8a8a60065462000c11565b905062000ae087878686868660075462000c63565b6001818155600489905560055462000afe9163ffffffff62000e1916565b600581905560405189917fb119f1f36224601586b5037da909ecf37e83864dddea5d32ad4e32ac1d97e62b9162000b3a91908e908e9062002316565b60405180910390a2505060016000555050505050505050565b60075481565b60015481565b60003084848460405162000b7390620010d0565b62000b82949392919062001ba5565b604051809103906000f08015801562000b9f573d6000803e3d6000fd5b5060055490915062000bb990600163ffffffff62000e1916565b60058190556040516001600160a01b038316917f82fe3a4fa49c6382d0c085746698ddbbafe6c2bf61285b19410644b5b26287c79162000c029189918991899189919062001de8565b60405180910390a25050505050565b6040516000906918da1958dadc1bda5b9d60b21b90829062000c40908590849088908b908b9060200162001c16565b60408051808303601f190181529190528051602090910120979650505050505050565b6000805b885181101562000d405786818151811062000c7e57fe5b602002602001015160ff1660001462000d375762000cf089828151811062000ca257fe5b60200260200101518589848151811062000cb857fe5b602002602001015189858151811062000ccd57fe5b602002602001015189868151811062000ce257fe5b602002602001015162000e6b565b62000d0f5760405162461bcd60e51b8152600401620002a7906200200f565b87818151811062000d1c57fe5b6020026020010151820191508282111562000d375762000d40565b60010162000c67565b5081811162000d635760405162461bcd60e51b8152600401620002a7906200216d565b5050505050505050565b62000dc78363a9059cbb60e01b848460405160240162000d8f92919062001bf4565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262000f0b565b505050565b606062000e1083836040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525062000fa2565b90505b92915050565b60008282018381101562000e105760405162461bcd60e51b8152600401620002a79062001fb5565b62000e65846323b872dd60e01b85858560405160240162000d8f9392919062001b81565b50505050565b6000808560405160200162000e81919062001b50565b6040516020818303038152906040528051906020012090506001818686866040516000815260200160405260405162000ebe949392919062001db5565b6020604051602081039080840390855afa15801562000ee1573d6000803e3d6000fd5b505050602060405103516001600160a01b0316876001600160a01b03161491505095945050505050565b606062000f62826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662000fa29092919063ffffffff16565b80519091501562000dc7578080602001905181019062000f839190620019b2565b62000dc75760405162461bcd60e51b8152600401620002a7906200225e565b606062000fb3848460008562000fbd565b90505b9392505050565b60608247101562000fe25760405162461bcd60e51b8152600401620002a79062002052565b62000fed856200108c565b6200100c5760405162461bcd60e51b8152600401620002a79062002227565b60006060866001600160a01b031685876040516200102b919062001b32565b60006040518083038185875af1925050503d80600081146200106a576040519150601f19603f3d011682016040523d82523d6000602084013e6200106f565b606091505b50915091506200108182828662001092565b979650505050505050565b3b151590565b60608315620010a357508162000fb6565b825115620010b45782518084602001fd5b8160405162461bcd60e51b8152600401620002a7919062001dd3565b610fc180620023d483390190565b80356001600160a01b038116811462000e1357600080fd5b600082601f83011262001107578081fd5b81356200111e620011188262002384565b6200235d565b8181529150602080830190848101818402860182018710156200114057600080fd5b60005b848110156200116b57620011588883620010de565b8452928201929082019060010162001143565b505050505092915050565b600082601f83011262001187578081fd5b813562001198620011188262002384565b818152915060208083019084810181840286018201871015620011ba57600080fd5b60005b848110156200116b57813584529282019290820190600101620011bd565b600082601f830112620011ec578081fd5b8135620011fd620011188262002384565b8181529150602080830190848101818402860182018710156200121f57600080fd5b60005b848110156200116b57620012378883620013dd565b8452928201929082019060010162001222565b600082601f8301126200125b578081fd5b81356001600160401b0381111562001271578182fd5b62001286601f8201601f19166020016200235d565b91508082528360208285010111156200129e57600080fd5b8060208401602084013760009082016020015292915050565b6000610120808385031215620012cb578182fd5b620012d6816200235d565b91505081356001600160401b0380821115620012f157600080fd5b620012ff8583860162001176565b835260208401359150808211156200131657600080fd5b6200132485838601620010f6565b602084015260408401359150808211156200133e57600080fd5b6200134c8583860162001176565b604084015260608401359150808211156200136657600080fd5b6200137485838601620010f6565b6060840152620013888560808601620010de565b608084015260a0840135915080821115620013a257600080fd5b50620013b1848285016200124a565b60a08301525060c082013560c082015260e082013560e082015261010080830135818301525092915050565b803560ff8116811462000e1357600080fd5b60006020828403121562001401578081fd5b62000e108383620010de565b60008060006060848603121562001422578182fd5b83356001600160a01b038116811462001439578283fd5b95602085013595506040909401359392505050565b600080600080600080600060e0888a03121562001469578283fd5b87356001600160401b038082111562001480578485fd5b6200148e8b838c01620010f6565b985060208a0135915080821115620014a4578485fd5b620014b28b838c0162001176565b975060408a0135915080821115620014c8578485fd5b620014d68b838c01620011db565b965060608a0135915080821115620014ec578485fd5b620014fa8b838c0162001176565b955060808a013591508082111562001510578485fd5b506200151f8a828b0162001176565b93505060a0880135915060c0880135905092959891949750929550565b60008060008060008060008060006101208a8c0312156200155b578182fd5b89356001600160401b038082111562001572578384fd5b620015808d838e01620010f6565b9a5060208c013591508082111562001596578384fd5b620015a48d838e0162001176565b995060408c0135985060608c0135915080821115620015c1578384fd5b620015cf8d838e01620010f6565b975060808c0135915080821115620015e5578384fd5b620015f38d838e0162001176565b965060a08c0135955060c08c013591508082111562001610578384fd5b6200161e8d838e01620011db565b945060e08c013591508082111562001634578384fd5b620016428d838e0162001176565b93506101008c013591508082111562001659578283fd5b50620016688c828d0162001176565b9150509295985092959850929598565b6000806000806000806000806000806000806101808d8f0312156200169b578586fd5b6001600160401b038d351115620016b0578586fd5b620016bf8e8e358f01620010f6565b9b506001600160401b0360208e01351115620016d9578586fd5b620016eb8e60208f01358f0162001176565b9a5060408d013599506001600160401b0360608e013511156200170c578586fd5b6200171e8e60608f01358f01620011db565b98506001600160401b0360808e0135111562001738578586fd5b6200174a8e60808f01358f0162001176565b97506001600160401b0360a08e0135111562001764578586fd5b620017768e60a08f01358f0162001176565b96506001600160401b0360c08e0135111562001790578586fd5b620017a28e60c08f01358f0162001176565b95506001600160401b0360e08e01351115620017bc578283fd5b620017ce8e60e08f01358f01620010f6565b94506001600160401b036101008e01351115620017e9578283fd5b620017fc8e6101008f01358f0162001176565b93506101208d01359250620018168e6101408f01620010de565b91506101608d013590509295989b509295989b509295989b565b600080600080600080600060e0888a0312156200184b578081fd5b87356001600160401b038082111562001862578283fd5b620018708b838c01620010f6565b985060208a013591508082111562001886578283fd5b620018948b838c0162001176565b975060408a0135965060608a0135915080821115620018b1578283fd5b620018bf8b838c01620011db565b955060808a0135915080821115620018d5578283fd5b620018e38b838c0162001176565b945060a08a0135915080821115620018f9578283fd5b620019078b838c0162001176565b935060c08a01359150808211156200191d578283fd5b506200192c8a828b01620012b7565b91505092959891949750929550565b6000806000806080858703121562001951578182fd5b84356001600160401b038082111562001968578384fd5b6200197688838901620010f6565b955060208701359150808211156200198c578384fd5b506200199b8782880162001176565b949794965050505060408301359260600135919050565b600060208284031215620019c4578081fd5b8151801515811462000e10578182fd5b600060208284031215620019e6578081fd5b5035919050565b6000806000806080858703121562001a03578182fd5b84356001600160401b038082111562001a1a578384fd5b62001a28888389016200124a565b9550602087013591508082111562001a3e578384fd5b62001a4c888389016200124a565b9450604087013591508082111562001a62578384fd5b5062001a71878288016200124a565b92505062001a838660608701620013dd565b905092959194509250565b6000815180845260208085019450808401835b8381101562001ac85781516001600160a01b03168752958201959082019060010162001aa1565b509495945050505050565b6000815180845260208085019450808401835b8381101562001ac85781518752958201959082019060010162001ae6565b6000815180845262001b1e816020860160208601620023a4565b601f01601f19169290920160200192915050565b6000825162001b46818460208701620023a4565b9190910192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b038516815260806020820181905260009062001bcb9083018662001b04565b828103604084015262001bdf818662001b04565b91505060ff8316606083015295945050505050565b6001600160a01b03929092168252602082015260400190565b90815260200190565b600086825285602083015284604083015260a0606083015262001c3d60a083018562001a8e565b828103608084015262001c51818562001ad3565b98975050505050505050565b60006101608d83528c602084015280604084015262001c7f8184018d62001ad3565b838103606085015262001c93818d62001a8e565b915050828103608084015262001caa818b62001ad3565b83810360a085015262001cbe818b62001a8e565b6001600160a01b038a1660c086015284810360e0860152915062001ce59050818862001b04565b61010084019690965250506101208101929092526101409091015298975050505050505050565b60006101008a835289602084015280604084015262001d2e8184018a62001ad3565b838103606085015262001d42818a62001a8e565b915050828103608084015262001d59818862001ad3565b60a084019690965250506001600160a01b039290921660c083015260e09091015295945050505050565b60008582528460208301526080604083015262001da4608083018562001b04565b905082606083015295945050505050565b93845260ff9290921660208401526040830152606082015260800190565b60006020825262000e10602083018462001b04565b600060a0825262001dfd60a083018862001b04565b828103602084015262001e11818862001b04565b838103604085015262001e25818862001b04565b60ff969096166060850152505050608001529392505050565b6020808252601690820152754d616c666f726d6564206c697374206f66206665657360501b604082015260600190565b6020808252603f908201527f537570706c6965642063757272656e742076616c696461746f727320616e642060408201527f706f7765727320646f206e6f74206d6174636820636865636b706f696e742e00606082015260800190565b60208082526036908201527f4e6577206261746368206e6f6e6365206d7573742062652067726561746572206040820152757468616e207468652063757272656e74206e6f6e636560501b606082015260800190565b6020808252601f908201527f4d616c666f726d6564206261746368206f66207472616e73616374696f6e7300604082015260600190565b6020808252603d908201527f4e657720696e76616c69646174696f6e206e6f6e6365206d757374206265206760408201527f726561746572207468616e207468652063757272656e74206e6f6e6365000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b602080825260099082015268151a5b5959081bdd5d60ba1b604082015260600190565b60208082526023908201527f56616c696461746f72207369676e617475726520646f6573206e6f74206d617460408201526231b41760e91b606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252603b908201527f42617463682074696d656f7574206d757374206265206772656174657220746860408201527f616e207468652063757272656e7420626c6f636b206865696768740000000000606082015260800190565b60208082526021908201527f4d616c666f726d6564206c697374206f6620746f6b656e207472616e736665726040820152607360f81b606082015260800190565b6020808252601b908201527f4d616c666f726d6564206e65772076616c696461746f72207365740000000000604082015260600190565b6020808252603c908201527f5375626d69747465642076616c696461746f7220736574207369676e6174757260408201527f657320646f206e6f74206861766520656e6f75676820706f7765722e00000000606082015260800190565b60208082526037908201527f4e65772076616c736574206e6f6e6365206d757374206265206772656174657260408201527f207468616e207468652063757272656e74206e6f6e6365000000000000000000606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f4d616c666f726d65642063757272656e742076616c696461746f722073657400604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008482526060602083015262002331606083018562001a8e565b828103604084015262002345818562001ad3565b9695505050505050565b918252602082015260400190565b6040518181016001600160401b03811182821017156200237c57600080fd5b604052919050565b60006001600160401b038211156200239a578081fd5b5060209081020190565b60005b83811015620023c1578181015183820152602001620023a7565b8381111562000e65575050600091015256fe6080604052600160ff1b6006553480156200001957600080fd5b5060405162000fc138038062000fc1833981810160405260808110156200003f57600080fd5b8151602083018051604051929492938301929190846401000000008211156200006757600080fd5b9083019060208201858111156200007d57600080fd5b82516401000000008111828201881017156200009857600080fd5b82525081516020918201929091019080838360005b83811015620000c7578181015183820152602001620000ad565b50505050905090810190601f168015620000f55780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011957600080fd5b9083019060208201858111156200012f57600080fd5b82516401000000008111828201881017156200014a57600080fd5b82525081516020918201929091019080838360005b83811015620001795781810151838201526020016200015f565b50505050905090810190601f168015620001a75780820380516001836020036101000a031916815260200191505b5060405260209081015185519093508592508491620001cc91600391850190620003b9565b508051620001e2906004906020840190620003b9565b50506005805460ff191660121790555062000206816001600160e01b036200022416565b6200021a846006546200023a60201b60201c565b505050506200045e565b6005805460ff191660ff92909216919091179055565b6001600160a01b03821662000296576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b620002ad600083836001600160e01b036200035216565b620002c9816002546200035760201b620009b61790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620002fc918390620009b662000357821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b600082820183811015620003b2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620003fc57805160ff19168380011785556200042c565b828001600101855582156200042c579182015b828111156200042c5782518255916020019190600101906200040f565b506200043a9291506200043e565b5090565b6200045b91905b808211156200043a576000815560010162000445565b90565b610b53806200046e6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80633950935111610071578063395093511461021257806370a082311461023e57806395d89b4114610264578063a457c2d71461026c578063a9059cbb14610298578063dd62ed3e146102c4576100b4565b806306fdde03146100b9578063095ea7b31461013657806318160ddd1461017657806323b872dd146101905780632ebdf54d146101c6578063313ce567146101f4575b600080fd5b6100c16102f2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fb5781810151838201526020016100e3565b50505050905090810190601f1680156101285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101626004803603604081101561014c57600080fd5b506001600160a01b038135169060200135610388565b604080519115158252519081900360200190f35b61017e6103a5565b60408051918252519081900360200190f35b610162600480360360608110156101a657600080fd5b506001600160a01b038135811691602081013590911690604001356103ab565b6101f2600480360360408110156101dc57600080fd5b506001600160a01b038135169060200135610438565b005b6101fc610446565b6040805160ff9092168252519081900360200190f35b6101626004803603604081101561022857600080fd5b506001600160a01b03813516906020013561044f565b61017e6004803603602081101561025457600080fd5b50356001600160a01b03166104a3565b6100c16104be565b6101626004803603604081101561028257600080fd5b506001600160a01b03813516906020013561051f565b610162600480360360408110156102ae57600080fd5b506001600160a01b03813516906020013561058d565b61017e600480360360408110156102da57600080fd5b506001600160a01b03813581169160200135166105a1565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561037e5780601f106103535761010080835404028352916020019161037e565b820191906000526020600020905b81548152906001019060200180831161036157829003601f168201915b5050505050905090565b600061039c6103956105cc565b84846105d0565b50600192915050565b60025490565b60006103b88484846106bc565b61042e846103c46105cc565b61042985604051806060016040528060288152602001610a88602891396001600160a01b038a166000908152600160205260408120906104026105cc565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61082316565b6105d0565b5060019392505050565b61044282826108ba565b5050565b60055460ff1690565b600061039c61045c6105cc565b84610429856001600061046d6105cc565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff6109b616565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561037e5780601f106103535761010080835404028352916020019161037e565b600061039c61052c6105cc565b8461042985604051806060016040528060258152602001610af960259139600160006105566105cc565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61082316565b600061039c61059a6105cc565b84846106bc565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166106155760405162461bcd60e51b8152600401808060200182810382526024815260200180610ad56024913960400191505060405180910390fd5b6001600160a01b03821661065a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610a406022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166107015760405162461bcd60e51b8152600401808060200182810382526025815260200180610ab06025913960400191505060405180910390fd5b6001600160a01b0382166107465760405162461bcd60e51b8152600401808060200182810382526023815260200180610a1d6023913960400191505060405180910390fd5b610751838383610a17565b61079481604051806060016040528060268152602001610a62602691396001600160a01b038616600090815260208190526040902054919063ffffffff61082316565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546107c9908263ffffffff6109b616565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156108b25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561087757818101518382015260200161085f565b50505050905090810190601f1680156108a45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216610915576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61092160008383610a17565b600254610934908263ffffffff6109b616565b6002556001600160a01b038216600090815260208190526040902054610960908263ffffffff6109b616565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600082820183811015610a10576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220465410ed025b5712ee2eaddad7a20856f64710d3b57e1ff91396130750dfabd564736f6c63430006060033a264697066735822122018de9c84330245743d440a39eb3a986a4b6ba93368acb80508a288ff06657a3d64736f6c63430006060033", - "deployedBytecode": "0x60806040523480156200001157600080fd5b5060043610620001185760003560e01c8063c227c30b11620000a5578063e3cb9f62116200006f578063e3cb9f621462000224578063e5a2b5d2146200023b578063f2b533071462000245578063f7955637146200024f5762000118565b8063c227c30b14620001c8578063c9d194d514620001df578063db7c4e5714620001f6578063df97174b146200020d5762000118565b80637dfb6f8611620000e75780637dfb6f86146200018657806383b435db146200019d578063b56561fe14620001b4578063bdda81d414620001be5762000118565b8063011b2174146200011d5780630c246c82146200014c5780631ffbe7f9146200016557806373b20547146200017c575b600080fd5b620001346200012e366004620013ef565b62000266565b60405162000143919062001c0d565b60405180910390f35b620001636200015d36600462001830565b62000281565b005b62000163620001763660046200140d565b620005ce565b6200013462000684565b6200013462000197366004620019d4565b6200068a565b62000163620001ae36600462001678565b6200069c565b6200013462000968565b620001346200096e565b62000163620001d93660046200193b565b62000974565b62000134620001f0366004620019d4565b62000989565b62000163620002073660046200144e565b6200099b565b620001346200021e366004620013ef565b620009b5565b62000163620002353660046200153c565b620009c7565b6200013462000b53565b6200013462000b59565b6200016362000260366004620019ed565b62000b5f565b6001600160a01b031660009081526002602052604090205490565b60026000541415620002b05760405162461bcd60e51b8152600401620002a790620022df565b60405180910390fd5b600260005560c08101514310620002db5760405162461bcd60e51b8152600401620002a79062001fec565b61010081015160e082015160009081526003602052604090205410620003155760405162461bcd60e51b8152600401620002a79062001f58565b8551875114801562000328575083518751145b801562000336575082518751145b801562000344575081518751145b620003635760405162461bcd60e51b8152600401620002a790620022a8565b6001546200037688888860065462000c11565b14620003965760405162461bcd60e51b8152600401620002a79062001e6e565b60208101515181515114620003bf5760405162461bcd60e51b8152600401620002a790620020f5565b80606001515181604001515114620003eb5760405162461bcd60e51b8152600401620002a79062001e3e565b6000600654681b1bd9da58d0d85b1b60ba1b836000015184602001518560400151866060015187608001518860a001518960c001518a60e001518b6101000151604051602001620004479b9a9998979695949392919062001c5d565b6040516020818303038152906040528051906020012090506200047288888787878660075462000c63565b61010082015160e08301516000908152600360205260408120919091555b825151811015620004f857620004ef836080015184600001518381518110620004b557fe5b602002602001015185602001518481518110620004ce57fe5b60200260200101516001600160a01b031662000d6d9092919063ffffffff16565b60010162000490565b5060606200050f83608001518460a0015162000dcc565b905060005b8360400151518110156200055a576200055133856040015183815181106200053857fe5b602002602001015186606001518481518110620004ce57fe5b60010162000514565b506005546200057190600163ffffffff62000e1916565b600581905560e08401516101008501516040517f7c2bb24f8e1b3725cb613d7f11ef97d9745cc97a0e40f730621c052d684077a193620005b693929186919062001d83565b60405180910390a15050600160005550505050505050565b60026000541415620005f45760405162461bcd60e51b8152600401620002a790620022df565b6002600055620006166001600160a01b03841633308463ffffffff62000e4116565b6005546200062c90600163ffffffff62000e1916565b6005819055604051839133916001600160a01b038716917fd7767894d73c589daeca9643f445f03d7be61aad2950c117e7cbff4176fca7e491620006729187916200234f565b60405180910390a45050600160005550565b60055481565b60036020526000908152604090205481565b60026000541415620006c25760405162461bcd60e51b8152600401620002a790620022df565b600260008181556001600160a01b038416815260209190915260409020548311620007015760405162461bcd60e51b8152600401620002a79062001ecb565b804310620007235760405162461bcd60e51b8152600401620002a79062002098565b8a518c5114801562000736575088518c51145b801562000744575087518c51145b801562000752575086518c51145b620007715760405162461bcd60e51b8152600401620002a790620022a8565b600154620007848d8d8d60065462000c11565b14620007a45760405162461bcd60e51b8152600401620002a79062001e6e565b84518651148015620007b7575083518651145b620007d65760405162461bcd60e51b8152600401620002a79062001f21565b620008348c8c8b8b8b6006546f0e8e4c2dce6c2c6e8d2dedc84c2e8c6d60831b8d8d8d8d8d8d6040516020016200081598979695949392919062001d0c565b6040516020818303038152906040528051906020012060075462000c63565b6001600160a01b0382166000908152600260205260408120849055805b8751811015620008d757620008a38782815181106200086c57fe5b60200260200101518983815181106200088157fe5b6020026020010151866001600160a01b031662000d6d9092919063ffffffff16565b620008cc868281518110620008b457fe5b60200260200101518362000e1990919063ffffffff16565b915060010162000851565b50620008f46001600160a01b038416338363ffffffff62000d6d16565b506005546200090b90600163ffffffff62000e1916565b60058190556040516001600160a01b0384169185917f02c7e81975f8edb86e2a0c038b7b86a49c744236abf0f6177ff5afc6986ab708916200094d9162001c0d565b60405180910390a35050600160005550505050505050505050565b60045481565b60065481565b620009828484848462000c11565b5050505050565b60009081526003602052604090205490565b620009ac8787878787878762000c63565b50505050505050565b60026020526000908152604090205481565b60026000541415620009ed5760405162461bcd60e51b8152600401620002a790620022df565b600260005583871162000a145760405162461bcd60e51b8152600401620002a790620021ca565b875189511462000a385760405162461bcd60e51b8152600401620002a79062002136565b8451865114801562000a4b575082518651145b801562000a59575081518651145b801562000a67575080518651145b62000a865760405162461bcd60e51b8152600401620002a790620022a8565b60015462000a9987878760065462000c11565b1462000ab95760405162461bcd60e51b8152600401620002a79062001e6e565b600062000acb8a8a8a60065462000c11565b905062000ae087878686868660075462000c63565b6001818155600489905560055462000afe9163ffffffff62000e1916565b600581905560405189917fb119f1f36224601586b5037da909ecf37e83864dddea5d32ad4e32ac1d97e62b9162000b3a91908e908e9062002316565b60405180910390a2505060016000555050505050505050565b60075481565b60015481565b60003084848460405162000b7390620010d0565b62000b82949392919062001ba5565b604051809103906000f08015801562000b9f573d6000803e3d6000fd5b5060055490915062000bb990600163ffffffff62000e1916565b60058190556040516001600160a01b038316917f82fe3a4fa49c6382d0c085746698ddbbafe6c2bf61285b19410644b5b26287c79162000c029189918991899189919062001de8565b60405180910390a25050505050565b6040516000906918da1958dadc1bda5b9d60b21b90829062000c40908590849088908b908b9060200162001c16565b60408051808303601f190181529190528051602090910120979650505050505050565b6000805b885181101562000d405786818151811062000c7e57fe5b602002602001015160ff1660001462000d375762000cf089828151811062000ca257fe5b60200260200101518589848151811062000cb857fe5b602002602001015189858151811062000ccd57fe5b602002602001015189868151811062000ce257fe5b602002602001015162000e6b565b62000d0f5760405162461bcd60e51b8152600401620002a7906200200f565b87818151811062000d1c57fe5b6020026020010151820191508282111562000d375762000d40565b60010162000c67565b5081811162000d635760405162461bcd60e51b8152600401620002a7906200216d565b5050505050505050565b62000dc78363a9059cbb60e01b848460405160240162000d8f92919062001bf4565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915262000f0b565b505050565b606062000e1083836040518060400160405280601e81526020017f416464726573733a206c6f772d6c6576656c2063616c6c206661696c6564000081525062000fa2565b90505b92915050565b60008282018381101562000e105760405162461bcd60e51b8152600401620002a79062001fb5565b62000e65846323b872dd60e01b85858560405160240162000d8f9392919062001b81565b50505050565b6000808560405160200162000e81919062001b50565b6040516020818303038152906040528051906020012090506001818686866040516000815260200160405260405162000ebe949392919062001db5565b6020604051602081039080840390855afa15801562000ee1573d6000803e3d6000fd5b505050602060405103516001600160a01b0316876001600160a01b03161491505095945050505050565b606062000f62826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b031662000fa29092919063ffffffff16565b80519091501562000dc7578080602001905181019062000f839190620019b2565b62000dc75760405162461bcd60e51b8152600401620002a7906200225e565b606062000fb3848460008562000fbd565b90505b9392505050565b60608247101562000fe25760405162461bcd60e51b8152600401620002a79062002052565b62000fed856200108c565b6200100c5760405162461bcd60e51b8152600401620002a79062002227565b60006060866001600160a01b031685876040516200102b919062001b32565b60006040518083038185875af1925050503d80600081146200106a576040519150601f19603f3d011682016040523d82523d6000602084013e6200106f565b606091505b50915091506200108182828662001092565b979650505050505050565b3b151590565b60608315620010a357508162000fb6565b825115620010b45782518084602001fd5b8160405162461bcd60e51b8152600401620002a7919062001dd3565b610fc180620023d483390190565b80356001600160a01b038116811462000e1357600080fd5b600082601f83011262001107578081fd5b81356200111e620011188262002384565b6200235d565b8181529150602080830190848101818402860182018710156200114057600080fd5b60005b848110156200116b57620011588883620010de565b8452928201929082019060010162001143565b505050505092915050565b600082601f83011262001187578081fd5b813562001198620011188262002384565b818152915060208083019084810181840286018201871015620011ba57600080fd5b60005b848110156200116b57813584529282019290820190600101620011bd565b600082601f830112620011ec578081fd5b8135620011fd620011188262002384565b8181529150602080830190848101818402860182018710156200121f57600080fd5b60005b848110156200116b57620012378883620013dd565b8452928201929082019060010162001222565b600082601f8301126200125b578081fd5b81356001600160401b0381111562001271578182fd5b62001286601f8201601f19166020016200235d565b91508082528360208285010111156200129e57600080fd5b8060208401602084013760009082016020015292915050565b6000610120808385031215620012cb578182fd5b620012d6816200235d565b91505081356001600160401b0380821115620012f157600080fd5b620012ff8583860162001176565b835260208401359150808211156200131657600080fd5b6200132485838601620010f6565b602084015260408401359150808211156200133e57600080fd5b6200134c8583860162001176565b604084015260608401359150808211156200136657600080fd5b6200137485838601620010f6565b6060840152620013888560808601620010de565b608084015260a0840135915080821115620013a257600080fd5b50620013b1848285016200124a565b60a08301525060c082013560c082015260e082013560e082015261010080830135818301525092915050565b803560ff8116811462000e1357600080fd5b60006020828403121562001401578081fd5b62000e108383620010de565b60008060006060848603121562001422578182fd5b83356001600160a01b038116811462001439578283fd5b95602085013595506040909401359392505050565b600080600080600080600060e0888a03121562001469578283fd5b87356001600160401b038082111562001480578485fd5b6200148e8b838c01620010f6565b985060208a0135915080821115620014a4578485fd5b620014b28b838c0162001176565b975060408a0135915080821115620014c8578485fd5b620014d68b838c01620011db565b965060608a0135915080821115620014ec578485fd5b620014fa8b838c0162001176565b955060808a013591508082111562001510578485fd5b506200151f8a828b0162001176565b93505060a0880135915060c0880135905092959891949750929550565b60008060008060008060008060006101208a8c0312156200155b578182fd5b89356001600160401b038082111562001572578384fd5b620015808d838e01620010f6565b9a5060208c013591508082111562001596578384fd5b620015a48d838e0162001176565b995060408c0135985060608c0135915080821115620015c1578384fd5b620015cf8d838e01620010f6565b975060808c0135915080821115620015e5578384fd5b620015f38d838e0162001176565b965060a08c0135955060c08c013591508082111562001610578384fd5b6200161e8d838e01620011db565b945060e08c013591508082111562001634578384fd5b620016428d838e0162001176565b93506101008c013591508082111562001659578283fd5b50620016688c828d0162001176565b9150509295985092959850929598565b6000806000806000806000806000806000806101808d8f0312156200169b578586fd5b6001600160401b038d351115620016b0578586fd5b620016bf8e8e358f01620010f6565b9b506001600160401b0360208e01351115620016d9578586fd5b620016eb8e60208f01358f0162001176565b9a5060408d013599506001600160401b0360608e013511156200170c578586fd5b6200171e8e60608f01358f01620011db565b98506001600160401b0360808e0135111562001738578586fd5b6200174a8e60808f01358f0162001176565b97506001600160401b0360a08e0135111562001764578586fd5b620017768e60a08f01358f0162001176565b96506001600160401b0360c08e0135111562001790578586fd5b620017a28e60c08f01358f0162001176565b95506001600160401b0360e08e01351115620017bc578283fd5b620017ce8e60e08f01358f01620010f6565b94506001600160401b036101008e01351115620017e9578283fd5b620017fc8e6101008f01358f0162001176565b93506101208d01359250620018168e6101408f01620010de565b91506101608d013590509295989b509295989b509295989b565b600080600080600080600060e0888a0312156200184b578081fd5b87356001600160401b038082111562001862578283fd5b620018708b838c01620010f6565b985060208a013591508082111562001886578283fd5b620018948b838c0162001176565b975060408a0135965060608a0135915080821115620018b1578283fd5b620018bf8b838c01620011db565b955060808a0135915080821115620018d5578283fd5b620018e38b838c0162001176565b945060a08a0135915080821115620018f9578283fd5b620019078b838c0162001176565b935060c08a01359150808211156200191d578283fd5b506200192c8a828b01620012b7565b91505092959891949750929550565b6000806000806080858703121562001951578182fd5b84356001600160401b038082111562001968578384fd5b6200197688838901620010f6565b955060208701359150808211156200198c578384fd5b506200199b8782880162001176565b949794965050505060408301359260600135919050565b600060208284031215620019c4578081fd5b8151801515811462000e10578182fd5b600060208284031215620019e6578081fd5b5035919050565b6000806000806080858703121562001a03578182fd5b84356001600160401b038082111562001a1a578384fd5b62001a28888389016200124a565b9550602087013591508082111562001a3e578384fd5b62001a4c888389016200124a565b9450604087013591508082111562001a62578384fd5b5062001a71878288016200124a565b92505062001a838660608701620013dd565b905092959194509250565b6000815180845260208085019450808401835b8381101562001ac85781516001600160a01b03168752958201959082019060010162001aa1565b509495945050505050565b6000815180845260208085019450808401835b8381101562001ac85781518752958201959082019060010162001ae6565b6000815180845262001b1e816020860160208601620023a4565b601f01601f19169290920160200192915050565b6000825162001b46818460208701620023a4565b9190910192915050565b7f19457468657265756d205369676e6564204d6573736167653a0a3332000000008152601c810191909152603c0190565b6001600160a01b039384168152919092166020820152604081019190915260600190565b6001600160a01b038516815260806020820181905260009062001bcb9083018662001b04565b828103604084015262001bdf818662001b04565b91505060ff8316606083015295945050505050565b6001600160a01b03929092168252602082015260400190565b90815260200190565b600086825285602083015284604083015260a0606083015262001c3d60a083018562001a8e565b828103608084015262001c51818562001ad3565b98975050505050505050565b60006101608d83528c602084015280604084015262001c7f8184018d62001ad3565b838103606085015262001c93818d62001a8e565b915050828103608084015262001caa818b62001ad3565b83810360a085015262001cbe818b62001a8e565b6001600160a01b038a1660c086015284810360e0860152915062001ce59050818862001b04565b61010084019690965250506101208101929092526101409091015298975050505050505050565b60006101008a835289602084015280604084015262001d2e8184018a62001ad3565b838103606085015262001d42818a62001a8e565b915050828103608084015262001d59818862001ad3565b60a084019690965250506001600160a01b039290921660c083015260e09091015295945050505050565b60008582528460208301526080604083015262001da4608083018562001b04565b905082606083015295945050505050565b93845260ff9290921660208401526040830152606082015260800190565b60006020825262000e10602083018462001b04565b600060a0825262001dfd60a083018862001b04565b828103602084015262001e11818862001b04565b838103604085015262001e25818862001b04565b60ff969096166060850152505050608001529392505050565b6020808252601690820152754d616c666f726d6564206c697374206f66206665657360501b604082015260600190565b6020808252603f908201527f537570706c6965642063757272656e742076616c696461746f727320616e642060408201527f706f7765727320646f206e6f74206d6174636820636865636b706f696e742e00606082015260800190565b60208082526036908201527f4e6577206261746368206e6f6e6365206d7573742062652067726561746572206040820152757468616e207468652063757272656e74206e6f6e636560501b606082015260800190565b6020808252601f908201527f4d616c666f726d6564206261746368206f66207472616e73616374696f6e7300604082015260600190565b6020808252603d908201527f4e657720696e76616c69646174696f6e206e6f6e6365206d757374206265206760408201527f726561746572207468616e207468652063757272656e74206e6f6e6365000000606082015260800190565b6020808252601b908201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604082015260600190565b602080825260099082015268151a5b5959081bdd5d60ba1b604082015260600190565b60208082526023908201527f56616c696461746f72207369676e617475726520646f6573206e6f74206d617460408201526231b41760e91b606082015260800190565b60208082526026908201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6040820152651c8818d85b1b60d21b606082015260800190565b6020808252603b908201527f42617463682074696d656f7574206d757374206265206772656174657220746860408201527f616e207468652063757272656e7420626c6f636b206865696768740000000000606082015260800190565b60208082526021908201527f4d616c666f726d6564206c697374206f6620746f6b656e207472616e736665726040820152607360f81b606082015260800190565b6020808252601b908201527f4d616c666f726d6564206e65772076616c696461746f72207365740000000000604082015260600190565b6020808252603c908201527f5375626d69747465642076616c696461746f7220736574207369676e6174757260408201527f657320646f206e6f74206861766520656e6f75676820706f7765722e00000000606082015260800190565b60208082526037908201527f4e65772076616c736574206e6f6e6365206d757374206265206772656174657260408201527f207468616e207468652063757272656e74206e6f6e6365000000000000000000606082015260800190565b6020808252601d908201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604082015260600190565b6020808252602a908201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6040820152691bdd081cdd58d8d9595960b21b606082015260800190565b6020808252601f908201527f4d616c666f726d65642063757272656e742076616c696461746f722073657400604082015260600190565b6020808252601f908201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604082015260600190565b60008482526060602083015262002331606083018562001a8e565b828103604084015262002345818562001ad3565b9695505050505050565b918252602082015260400190565b6040518181016001600160401b03811182821017156200237c57600080fd5b604052919050565b60006001600160401b038211156200239a578081fd5b5060209081020190565b60005b83811015620023c1578181015183820152602001620023a7565b8381111562000e65575050600091015256fe6080604052600160ff1b6006553480156200001957600080fd5b5060405162000fc138038062000fc1833981810160405260808110156200003f57600080fd5b8151602083018051604051929492938301929190846401000000008211156200006757600080fd5b9083019060208201858111156200007d57600080fd5b82516401000000008111828201881017156200009857600080fd5b82525081516020918201929091019080838360005b83811015620000c7578181015183820152602001620000ad565b50505050905090810190601f168015620000f55780820380516001836020036101000a031916815260200191505b50604052602001805160405193929190846401000000008211156200011957600080fd5b9083019060208201858111156200012f57600080fd5b82516401000000008111828201881017156200014a57600080fd5b82525081516020918201929091019080838360005b83811015620001795781810151838201526020016200015f565b50505050905090810190601f168015620001a75780820380516001836020036101000a031916815260200191505b5060405260209081015185519093508592508491620001cc91600391850190620003b9565b508051620001e2906004906020840190620003b9565b50506005805460ff191660121790555062000206816001600160e01b036200022416565b6200021a846006546200023a60201b60201c565b505050506200045e565b6005805460ff191660ff92909216919091179055565b6001600160a01b03821662000296576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b620002ad600083836001600160e01b036200035216565b620002c9816002546200035760201b620009b61790919060201c565b6002556001600160a01b03821660009081526020818152604090912054620002fc918390620009b662000357821b17901c565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b505050565b600082820183811015620003b2576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10620003fc57805160ff19168380011785556200042c565b828001600101855582156200042c579182015b828111156200042c5782518255916020019190600101906200040f565b506200043a9291506200043e565b5090565b6200045b91905b808211156200043a576000815560010162000445565b90565b610b53806200046e6000396000f3fe608060405234801561001057600080fd5b50600436106100b45760003560e01c80633950935111610071578063395093511461021257806370a082311461023e57806395d89b4114610264578063a457c2d71461026c578063a9059cbb14610298578063dd62ed3e146102c4576100b4565b806306fdde03146100b9578063095ea7b31461013657806318160ddd1461017657806323b872dd146101905780632ebdf54d146101c6578063313ce567146101f4575b600080fd5b6100c16102f2565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100fb5781810151838201526020016100e3565b50505050905090810190601f1680156101285780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101626004803603604081101561014c57600080fd5b506001600160a01b038135169060200135610388565b604080519115158252519081900360200190f35b61017e6103a5565b60408051918252519081900360200190f35b610162600480360360608110156101a657600080fd5b506001600160a01b038135811691602081013590911690604001356103ab565b6101f2600480360360408110156101dc57600080fd5b506001600160a01b038135169060200135610438565b005b6101fc610446565b6040805160ff9092168252519081900360200190f35b6101626004803603604081101561022857600080fd5b506001600160a01b03813516906020013561044f565b61017e6004803603602081101561025457600080fd5b50356001600160a01b03166104a3565b6100c16104be565b6101626004803603604081101561028257600080fd5b506001600160a01b03813516906020013561051f565b610162600480360360408110156102ae57600080fd5b506001600160a01b03813516906020013561058d565b61017e600480360360408110156102da57600080fd5b506001600160a01b03813581169160200135166105a1565b60038054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561037e5780601f106103535761010080835404028352916020019161037e565b820191906000526020600020905b81548152906001019060200180831161036157829003601f168201915b5050505050905090565b600061039c6103956105cc565b84846105d0565b50600192915050565b60025490565b60006103b88484846106bc565b61042e846103c46105cc565b61042985604051806060016040528060288152602001610a88602891396001600160a01b038a166000908152600160205260408120906104026105cc565b6001600160a01b03168152602081019190915260400160002054919063ffffffff61082316565b6105d0565b5060019392505050565b61044282826108ba565b5050565b60055460ff1690565b600061039c61045c6105cc565b84610429856001600061046d6105cc565b6001600160a01b03908116825260208083019390935260409182016000908120918c16815292529020549063ffffffff6109b616565b6001600160a01b031660009081526020819052604090205490565b60048054604080516020601f600260001961010060018816150201909516949094049384018190048102820181019092528281526060939092909183018282801561037e5780601f106103535761010080835404028352916020019161037e565b600061039c61052c6105cc565b8461042985604051806060016040528060258152602001610af960259139600160006105566105cc565b6001600160a01b03908116825260208083019390935260409182016000908120918d1681529252902054919063ffffffff61082316565b600061039c61059a6105cc565b84846106bc565b6001600160a01b03918216600090815260016020908152604080832093909416825291909152205490565b3390565b6001600160a01b0383166106155760405162461bcd60e51b8152600401808060200182810382526024815260200180610ad56024913960400191505060405180910390fd5b6001600160a01b03821661065a5760405162461bcd60e51b8152600401808060200182810382526022815260200180610a406022913960400191505060405180910390fd5b6001600160a01b03808416600081815260016020908152604080832094871680845294825291829020859055815185815291517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9259281900390910190a3505050565b6001600160a01b0383166107015760405162461bcd60e51b8152600401808060200182810382526025815260200180610ab06025913960400191505060405180910390fd5b6001600160a01b0382166107465760405162461bcd60e51b8152600401808060200182810382526023815260200180610a1d6023913960400191505060405180910390fd5b610751838383610a17565b61079481604051806060016040528060268152602001610a62602691396001600160a01b038616600090815260208190526040902054919063ffffffff61082316565b6001600160a01b0380851660009081526020819052604080822093909355908416815220546107c9908263ffffffff6109b616565b6001600160a01b038084166000818152602081815260409182902094909455805185815290519193928716927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef92918290030190a3505050565b600081848411156108b25760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561087757818101518382015260200161085f565b50505050905090810190601f1680156108a45780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b505050900390565b6001600160a01b038216610915576040805162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f206164647265737300604482015290519081900360640190fd5b61092160008383610a17565b600254610934908263ffffffff6109b616565b6002556001600160a01b038216600090815260208190526040902054610960908263ffffffff6109b616565b6001600160a01b0383166000818152602081815260408083209490945583518581529351929391927fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9281900390910190a35050565b600082820183811015610a10576040805162461bcd60e51b815260206004820152601b60248201527f536166654d6174683a206164646974696f6e206f766572666c6f770000000000604482015290519081900360640190fd5b9392505050565b50505056fe45524332303a207472616e7366657220746f20746865207a65726f206164647265737345524332303a20617070726f766520746f20746865207a65726f206164647265737345524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e636545524332303a207472616e7366657220616d6f756e74206578636565647320616c6c6f77616e636545524332303a207472616e736665722066726f6d20746865207a65726f206164647265737345524332303a20617070726f76652066726f6d20746865207a65726f206164647265737345524332303a2064656372656173656420616c6c6f77616e63652062656c6f77207a65726fa2646970667358221220465410ed025b5712ee2eaddad7a20856f64710d3b57e1ff91396130750dfabd564736f6c63430006060033a264697066735822122018de9c84330245743d440a39eb3a986a4b6ba93368acb80508a288ff06657a3d64736f6c63430006060033", - "linkReferences": {}, - "deployedLinkReferences": {} -} diff --git a/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json b/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json index 39dba74c8f..f653f82935 100644 --- a/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json +++ b/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json @@ -2,11 +2,11 @@ "_format": "hh-sol-cache-2", "files": { "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol": { - "lastModificationDate": 1639657373736, - "contentHash": "ac31a05f19ad88d4c28011a830d29b56", + "lastModificationDate": 1641813499577, + "contentHash": "019fffdd8521017f63b3e923d292c025", "sourceName": "contracts/BandwidthGenerator.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -31,21 +31,21 @@ "./CosmosToken.sol", "./Gravity.sol", "@openzeppelin/contracts/access/Ownable.sol", - "@openzeppelin/contracts/math/SafeMath.sol" + "@openzeppelin/contracts/utils/math/SafeMath.sol" ], "versionPragmas": [ - "0.6.6" + "0.8.10" ], "artifacts": [ "BandwidthGenerator" ] }, "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/CosmosToken.sol": { - "lastModificationDate": 1639657191231, - "contentHash": "0f05f96ee3c1151b6cd4b699aa3167e9", + "lastModificationDate": 1641811013678, + "contentHash": "fc5dd09fe73bc6cfece970f702a3aba1", "sourceName": "contracts/CosmosToken.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -70,18 +70,18 @@ "@openzeppelin/contracts/token/ERC20/ERC20.sol" ], "versionPragmas": [ - "^0.6.6" + "0.8.10" ], "artifacts": [ "CosmosERC20" ] }, "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/Gravity.sol": { - "lastModificationDate": 1639657191231, - "contentHash": "eaa1cd71cea24d419ef5f67a66dc672e", + "lastModificationDate": 1641810221576, + "contentHash": "0d6dae561f7b541bafb892b8593a08ac", "sourceName": "contracts/Gravity.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -103,26 +103,26 @@ } }, "imports": [ - "@openzeppelin/contracts/math/SafeMath.sol", "@openzeppelin/contracts/token/ERC20/IERC20.sol", - "@openzeppelin/contracts/token/ERC20/SafeERC20.sol", + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "@openzeppelin/contracts/security/ReentrancyGuard.sol", "@openzeppelin/contracts/utils/Address.sol", - "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", "./CosmosToken.sol" ], "versionPragmas": [ - "^0.6.6" + "0.8.10" ], "artifacts": [ "Gravity" ] }, "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/access/Ownable.sol": { - "lastModificationDate": 1639657303711, - "contentHash": "6748815a5b45c4aeeda56819f41190e0", + "lastModificationDate": 1641812554274, + "contentHash": "4fe56b59ced59d87df6b796758f62895", "sourceName": "@openzeppelin/contracts/access/Ownable.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -147,18 +147,18 @@ "../utils/Context.sol" ], "versionPragmas": [ - ">=0.6.0 <0.8.0" + "^0.8.0" ], "artifacts": [ "Ownable" ] }, - "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/math/SafeMath.sol": { - "lastModificationDate": 1639657303763, - "contentHash": "e03e12206057e809eb76c5f681170c32", - "sourceName": "@openzeppelin/contracts/math/SafeMath.sol", + "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/math/SafeMath.sol": { + "lastModificationDate": 1641812554378, + "contentHash": "5365090efc586b728719e562ebfed0d6", + "sourceName": "@openzeppelin/contracts/utils/math/SafeMath.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -181,18 +181,18 @@ }, "imports": [], "versionPragmas": [ - ">=0.6.0 <0.8.0" + "^0.8.0" ], "artifacts": [ "SafeMath" ] }, "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/token/ERC20/ERC20.sol": { - "lastModificationDate": 1639657303507, - "contentHash": "8065b340476f61365c076897199425f1", + "lastModificationDate": 1641812553614, + "contentHash": "2cd550cedf51b8d294607dad5023d717", "sourceName": "@openzeppelin/contracts/token/ERC20/ERC20.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -214,57 +214,23 @@ } }, "imports": [ - "../../utils/Context.sol", "./IERC20.sol", - "../../math/SafeMath.sol" + "./extensions/IERC20Metadata.sol", + "../../utils/Context.sol" ], "versionPragmas": [ - ">=0.6.0 <0.8.0" + "^0.8.0" ], "artifacts": [ "ERC20" ] }, - "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/Context.sol": { - "lastModificationDate": 1639657303395, - "contentHash": "2adbd82f6d055a4751566d4671512b03", - "sourceName": "@openzeppelin/contracts/utils/Context.sol", - "solcConfig": { - "version": "0.6.6", - "settings": { - "optimizer": { - "enabled": true, - "runs": 200 - }, - "outputSelection": { - "*": { - "*": [ - "abi", - "evm.bytecode", - "evm.deployedBytecode", - "evm.methodIdentifiers" - ], - "": [ - "ast" - ] - } - } - } - }, - "imports": [], - "versionPragmas": [ - ">=0.6.0 <0.8.0" - ], - "artifacts": [ - "Context" - ] - }, "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/token/ERC20/IERC20.sol": { - "lastModificationDate": 1639657303639, - "contentHash": "e0a41531d159d3a32f84b7a3ecf9fabb", + "lastModificationDate": 1641812554110, + "contentHash": "0eac3e1a83ee62326ca007811285b274", "sourceName": "@openzeppelin/contracts/token/ERC20/IERC20.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -287,18 +253,18 @@ }, "imports": [], "versionPragmas": [ - ">=0.6.0 <0.8.0" + "^0.8.0" ], "artifacts": [ "IERC20" ] }, - "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/token/ERC20/SafeERC20.sol": { - "lastModificationDate": 1639657303759, - "contentHash": "33e22842646d746e5c4124c2fdc051aa", - "sourceName": "@openzeppelin/contracts/token/ERC20/SafeERC20.sol", + "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol": { + "lastModificationDate": 1641812554118, + "contentHash": "aa1be06992a99bb7393b26a6af3c4dfb", + "sourceName": "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -320,23 +286,92 @@ } }, "imports": [ - "./IERC20.sol", - "../../math/SafeMath.sol", - "../../utils/Address.sol" + "../IERC20.sol" ], "versionPragmas": [ - ">=0.6.0 <0.8.0" + "^0.8.0" + ], + "artifacts": [ + "IERC20Metadata" + ] + }, + "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/Context.sol": { + "lastModificationDate": 1641812553346, + "contentHash": "851485d5b925529b1a2f34a0be077891", + "sourceName": "@openzeppelin/contracts/utils/Context.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": [ + "Context" + ] + }, + "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol": { + "lastModificationDate": 1641812554370, + "contentHash": "d37406082a74a9b6b114de522fcb6349", + "sourceName": "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "solcConfig": { + "version": "0.8.10", + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers" + ], + "": [ + "ast" + ] + } + } + } + }, + "imports": [ + "../IERC20.sol", + "../../../utils/Address.sol" + ], + "versionPragmas": [ + "^0.8.0" ], "artifacts": [ "SafeERC20" ] }, - "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/Address.sol": { - "lastModificationDate": 1639657303363, - "contentHash": "7aa46886ff5abe7515496208a5e2ce5a", - "sourceName": "@openzeppelin/contracts/utils/Address.sol", + "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/security/ReentrancyGuard.sol": { + "lastModificationDate": 1641812554322, + "contentHash": "53fbff678f378956efcb207fa748eaa6", + "sourceName": "@openzeppelin/contracts/security/ReentrancyGuard.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -359,18 +394,52 @@ }, "imports": [], "versionPragmas": [ - ">=0.6.2 <0.8.0" + "^0.8.0" + ], + "artifacts": [ + "ReentrancyGuard" + ] + }, + "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/Address.sol": { + "lastModificationDate": 1641812553270, + "contentHash": "c5f6c4e4df069c789e7d84b4c3011913", + "sourceName": "@openzeppelin/contracts/utils/Address.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": [ "Address" ] }, - "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/ReentrancyGuard.sol": { - "lastModificationDate": 1639657303747, - "contentHash": "1c60f58cee45c61469e1aea31e4dd879", - "sourceName": "@openzeppelin/contracts/utils/ReentrancyGuard.sol", + "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/node_modules/@openzeppelin/contracts/utils/cryptography/ECDSA.sol": { + "lastModificationDate": 1641812553414, + "contentHash": "197dbfaf7146845fa76331a4c9980e9f", + "sourceName": "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", "solcConfig": { - "version": "0.6.6", + "version": "0.8.10", "settings": { "optimizer": { "enabled": true, @@ -393,10 +462,87 @@ }, "imports": [], "versionPragmas": [ - ">=0.6.0 <0.8.0" + "^0.8.0" ], "artifacts": [ - "ReentrancyGuard" + "ECDSA" + ] + }, + "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/test-contracts/TestCosmosToken.sol": { + "lastModificationDate": 1641813266722, + "contentHash": "957b6079ee0d5a6e048fce8555c14dee", + "sourceName": "contracts/test-contracts/TestCosmosToken.sol", + "solcConfig": { + "version": "0.8.10", + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers" + ], + "": [ + "ast" + ] + } + } + } + }, + "imports": [ + "@openzeppelin/contracts/token/ERC20/ERC20.sol" + ], + "versionPragmas": [ + "0.8.10" + ], + "artifacts": [ + "TestCosmosERC20" + ] + }, + "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol": { + "lastModificationDate": 1641813465624, + "contentHash": "5c725464b149a3862c88db62891d8f66", + "sourceName": "contracts/test-contracts/TestGravity.sol", + "solcConfig": { + "version": "0.8.10", + "settings": { + "optimizer": { + "enabled": true, + "runs": 200 + }, + "outputSelection": { + "*": { + "*": [ + "abi", + "evm.bytecode", + "evm.deployedBytecode", + "evm.methodIdentifiers" + ], + "": [ + "ast" + ] + } + } + } + }, + "imports": [ + "@openzeppelin/contracts/token/ERC20/IERC20.sol", + "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol", + "@openzeppelin/contracts/security/ReentrancyGuard.sol", + "@openzeppelin/contracts/utils/Address.sol", + "@openzeppelin/contracts/utils/cryptography/ECDSA.sol", + "./TestCosmosToken.sol" + ], + "versionPragmas": [ + "0.8.10" + ], + "artifacts": [ + "Gravity" ] } } diff --git a/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol b/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol index 2438476670..ba1b7d587a 100644 --- a/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol +++ b/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol @@ -1,9 +1,9 @@ -pragma solidity 0.6.6; +pragma solidity 0.8.10; import "./CosmosToken.sol"; import "./Gravity.sol"; import "@openzeppelin/contracts/access/Ownable.sol"; -import "@openzeppelin/contracts/math/SafeMath.sol"; +import "@openzeppelin/contracts/utils/math/SafeMath.sol"; /** * @title BandwidthGenerator @@ -28,7 +28,7 @@ contract BandwidthGenerator is Ownable { uint256 Bandwidth, uint256 indexed VerificationKey, bytes SignedVerificationKey, - bytes32 indexed CosmosRecipient + string indexed CosmosRecipient ); event RatioChanged( @@ -39,7 +39,7 @@ contract BandwidthGenerator is Ownable { * @param _erc20 Address of the erc20NYM deployed through the Gravity Bridge. * @param _gravityBridge Address of the deployed Gravity Bridge. */ - constructor(CosmosERC20 _erc20, Gravity _gravityBridge) public { + constructor(CosmosERC20 _erc20, Gravity _gravityBridge) { require(address(_erc20) != address(0), "BandwidthGenerator: erc20 address cannot be null"); require(address(_gravityBridge) != address(0), "BandwidthGenerator: gravity bridge address cannot be null"); erc20 = _erc20; @@ -65,7 +65,7 @@ contract BandwidthGenerator is Ownable { * @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, bytes32 _cosmosRecipient) public { + function generateBasicBandwidthCredential(uint256 _amount, uint256 _verificationKey, bytes memory _signedVerificationKey, string memory _cosmosRecipient) public { require(_signedVerificationKey.length == 64, "BandwidthGenerator: Signature doesn't have 64 bytes"); erc20.transferFrom(msg.sender, address(this), _amount); erc20.approve(address(gravityBridge), _amount); diff --git a/contracts/basic-bandwidth-generation/contracts/CosmosToken.sol b/contracts/basic-bandwidth-generation/contracts/CosmosToken.sol index a2714161b5..9c5556cd79 100644 --- a/contracts/basic-bandwidth-generation/contracts/CosmosToken.sol +++ b/contracts/basic-bandwidth-generation/contracts/CosmosToken.sol @@ -1,33 +1,35 @@ -pragma solidity ^0.6.6; +//SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.10; import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; -/** -* This is a slightly modified version of the cosmos erc20 contract -* which I have done for unit testing. -* -* All that has been changed is the MAX_UINT variable to allow -* me to mint some tokens more easily in unit tests, and the -* addition of the public mint() function. - */ - contract CosmosERC20 is ERC20 { - /* canonical amount */ - // uint256 MAX_UINT = 2**256 - 1; + uint256 MAX_UINT = 2**256 - 1; + uint8 private cosmosDecimals; + address private gravityAddress; - /* unit testing amount */ - uint256 HALF_MAX_UINT = 2**256 / 2; + // This override ensures we return the proper number of decimals + // for the cosmos token + function decimals() public view virtual override returns (uint8) { + return cosmosDecimals; + } + + // This is not an accurate total supply. Instead this is the total supply + // of the given cosmos asset on Ethereum at this moment in time. Keeping + // a totally accurate supply would require constant updates from the Cosmos + // side, while in theory this could be piggy-backed on some existing bridge + // operation it's a lot of complextiy to add so we chose to forgoe it. + function totalSupply() public view virtual override returns (uint256) { + return MAX_UINT - balanceOf(gravityAddress); + } constructor( address _gravityAddress, string memory _name, string memory _symbol, uint8 _decimals - ) public ERC20(_name, _symbol) { - _setupDecimals(_decimals); - _mint(_gravityAddress, HALF_MAX_UINT); + ) ERC20(_name, _symbol) { + cosmosDecimals = _decimals; + gravityAddress = _gravityAddress; + _mint(_gravityAddress, MAX_UINT); } - - function mintForUnitTesting(address _to, uint _amount) public { - _mint(_to, _amount); - } -} +} \ No newline at end of file diff --git a/contracts/basic-bandwidth-generation/contracts/Gravity.sol b/contracts/basic-bandwidth-generation/contracts/Gravity.sol index 15bca4aab8..0b541280e1 100644 --- a/contracts/basic-bandwidth-generation/contracts/Gravity.sol +++ b/contracts/basic-bandwidth-generation/contracts/Gravity.sol @@ -1,13 +1,27 @@ -pragma solidity ^0.6.6; +//SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.10; -import "@openzeppelin/contracts/math/SafeMath.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import "@openzeppelin/contracts/token/ERC20/SafeERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import "@openzeppelin/contracts/utils/Address.sol"; -import "@openzeppelin/contracts/utils/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; import "./CosmosToken.sol"; -pragma experimental ABIEncoderV2; +error InvalidSignature(); +error InvalidValsetNonce(uint256 newNonce, uint256 currentNonce); +error InvalidBatchNonce(uint256 newNonce, uint256 currentNonce); +error InvalidLogicCallNonce(uint256 newNonce, uint256 currentNonce); +error InvalidLogicCallTransfers(); +error InvalidLogicCallFees(); +error InvalidSendToCosmos(); +error IncorrectCheckpoint(); +error MalformedNewValidatorSet(); +error MalformedCurrentValidatorSet(); +error MalformedBatch(); +error InsufficientPower(uint256 cumulativePower, uint256 powerThreshold); +error BatchTimedOut(); +error LogicCallTimedOut(); // This is being used purely to avoid stack too deep errors struct LogicCallArgs { @@ -26,10 +40,36 @@ struct LogicCallArgs { uint256 invalidationNonce; } +// This is used purely to avoid stack too deep errors +// represents everything about a given validator set +struct ValsetArgs { + // the validators in this set, represented by an Ethereum address + address[] validators; + // the powers of the given validators in the same order as above + uint256[] powers; + // the nonce of this validator set + uint256 valsetNonce; + // the reward amount denominated in the below reward token, can be + // set to zero + uint256 rewardAmount; + // the reward token, should be set to the zero address if not being used + address rewardToken; +} + +// This represents a validator signature +struct Signature { + uint8 v; + bytes32 r; + bytes32 s; +} + contract Gravity is ReentrancyGuard { - using SafeMath for uint256; using SafeERC20 for IERC20; + // The number of 'votes' required to execute a valset + // update or batch execution, set to 2/3 of 2^32 + uint256 constant constant_powerThreshold = 2863311530; + // These are updated often bytes32 public state_lastValsetCheckpoint; mapping(address => uint256) public state_lastBatchNonces; @@ -39,9 +79,8 @@ contract Gravity is ReentrancyGuard { // value indicating that no events have yet been submitted uint256 public state_lastEventNonce = 1; - // These are set once at initialization - bytes32 public state_gravityId; - uint256 public state_powerThreshold; + // This is set once at initialization + bytes32 public immutable state_gravityId; // TransactionBatchExecutedEvent and SendToCosmosEvent both include the field _eventNonce. // This is incremented every time one of these events is emitted. It is checked by the @@ -57,7 +96,7 @@ contract Gravity is ReentrancyGuard { event SendToCosmosEvent( address indexed _tokenContract, address indexed _sender, - bytes32 indexed _destination, + string _destination, uint256 _amount, uint256 _eventNonce ); @@ -73,6 +112,8 @@ contract Gravity is ReentrancyGuard { event ValsetUpdatedEvent( uint256 indexed _newValsetNonce, uint256 _eventNonce, + uint256 _rewardAmount, + address _rewardToken, address[] _validators, uint256[] _powers ); @@ -85,42 +126,26 @@ contract Gravity is ReentrancyGuard { // TEST FIXTURES // These are here to make it easier to measure gas usage. They should be removed before production - function testMakeCheckpoint( - address[] memory _validators, - uint256[] memory _powers, - uint256 _valsetNonce, - bytes32 _gravityId - ) public pure { - makeCheckpoint(_validators, _powers, _valsetNonce, _gravityId); + function testMakeCheckpoint(ValsetArgs calldata _valsetArgs, bytes32 _gravityId) external pure { + makeCheckpoint(_valsetArgs, _gravityId); } function testCheckValidatorSignatures( - address[] memory _currentValidators, - uint256[] memory _currentPowers, - uint8[] memory _v, - bytes32[] memory _r, - bytes32[] memory _s, + ValsetArgs calldata _currentValset, + Signature[] calldata _sigs, bytes32 _theHash, uint256 _powerThreshold - ) public pure { - checkValidatorSignatures( - _currentValidators, - _currentPowers, - _v, - _r, - _s, - _theHash, - _powerThreshold - ); + ) external pure { + checkValidatorSignatures(_currentValset, _sigs, _theHash, _powerThreshold); } // END TEST FIXTURES - function lastBatchNonce(address _erc20Address) public view returns (uint256) { + function lastBatchNonce(address _erc20Address) external view returns (uint256) { return state_lastBatchNonces[_erc20Address]; } - function lastLogicCallNonce(bytes32 _invalidation_id) public view returns (uint256) { + function lastLogicCallNonce(bytes32 _invalidation_id) external view returns (uint256) { return state_invalidationMapping[_invalidation_id]; } @@ -128,13 +153,23 @@ contract Gravity is ReentrancyGuard { function verifySig( address _signer, bytes32 _theHash, - uint8 _v, - bytes32 _r, - bytes32 _s + Signature calldata _sig ) private pure returns (bool) { - bytes32 messageDigest = - keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n32", _theHash)); - return _signer == ecrecover(messageDigest, _v, _r, _s); + bytes32 messageDigest = keccak256( + abi.encodePacked("\x19Ethereum Signed Message:\n32", _theHash) + ); + return _signer == ECDSA.recover(messageDigest, _sig.v, _sig.r, _sig.s); + } + + // Utility function to determine that a validator set and signatures are well formed + function validateValset(ValsetArgs calldata _valset, Signature[] calldata _sigs) private pure { + // Check that current validators, powers, and signatures (v,r,s) set is well-formed + if ( + _valset.validators.length != _valset.powers.length || + _valset.validators.length != _sigs.length + ) { + revert MalformedCurrentValidatorSet(); + } } // Make a new checkpoint from the supplied validator set @@ -145,47 +180,51 @@ contract Gravity is ReentrancyGuard { // Where h is the keccak256 hash function. // The validator powers must be decreasing or equal. This is important for checking the signatures on the // next valset, since it allows the caller to stop verifying signatures once a quorum of signatures have been verified. - function makeCheckpoint( - address[] memory _validators, - uint256[] memory _powers, - uint256 _valsetNonce, - bytes32 _gravityId - ) private pure returns (bytes32) { + function makeCheckpoint(ValsetArgs memory _valsetArgs, bytes32 _gravityId) + private + pure + returns (bytes32) + { // bytes32 encoding of the string "checkpoint" bytes32 methodName = 0x636865636b706f696e7400000000000000000000000000000000000000000000; - bytes32 checkpoint = - keccak256(abi.encode(_gravityId, methodName, _valsetNonce, _validators, _powers)); + bytes32 checkpoint = keccak256( + abi.encode( + _gravityId, + methodName, + _valsetArgs.valsetNonce, + _valsetArgs.validators, + _valsetArgs.powers, + _valsetArgs.rewardAmount, + _valsetArgs.rewardToken + ) + ); return checkpoint; } function checkValidatorSignatures( // The current validator set and their powers - address[] memory _currentValidators, - uint256[] memory _currentPowers, + ValsetArgs calldata _currentValset, // The current validator's signatures - uint8[] memory _v, - bytes32[] memory _r, - bytes32[] memory _s, + Signature[] calldata _sigs, // This is what we are checking they have signed bytes32 _theHash, uint256 _powerThreshold ) private pure { uint256 cumulativePower = 0; - for (uint256 i = 0; i < _currentValidators.length; i++) { + for (uint256 i = 0; i < _currentValset.validators.length; i++) { // If v is set to 0, this signifies that it was not possible to get a signature from this validator and we skip evaluation // (In a valid signature, it is either 27 or 28) - if (_v[i] != 0) { + if (_sigs[i].v != 0) { // Check that the current validator has signed off on the hash - require( - verifySig(_currentValidators[i], _theHash, _v[i], _r[i], _s[i]), - "Validator signature does not match." - ); + if (!verifySig(_currentValset.validators[i], _theHash, _sigs[i])) { + revert InvalidSignature(); + } // Sum up cumulative power - cumulativePower = cumulativePower + _currentPowers[i]; + cumulativePower = cumulativePower + _currentValset.powers[i]; // Break early to avoid wasting gas if (cumulativePower > _powerThreshold) { @@ -195,76 +234,81 @@ contract Gravity is ReentrancyGuard { } // Check that there was enough power - require( - cumulativePower > _powerThreshold, - "Submitted validator set signatures do not have enough power." - ); + if (cumulativePower <= _powerThreshold) { + revert InsufficientPower(cumulativePower, _powerThreshold); + } // Success } // This updates the valset by checking that the validators in the current valset have signed off on the // new valset. The signatures supplied are the signatures of the current valset over the checkpoint hash // generated from the new valset. - // Anyone can call this function, but they must supply valid signatures of state_powerThreshold of the current valset over + // Anyone can call this function, but they must supply valid signatures of constant_powerThreshold of the current valset over // the new valset. function updateValset( // The new version of the validator set - address[] memory _newValidators, - uint256[] memory _newPowers, - uint256 _newValsetNonce, + ValsetArgs calldata _newValset, // The current validators that approve the change - address[] memory _currentValidators, - uint256[] memory _currentPowers, - uint256 _currentValsetNonce, + ValsetArgs calldata _currentValset, // These are arrays of the parts of the current validator's signatures - uint8[] memory _v, - bytes32[] memory _r, - bytes32[] memory _s - ) public nonReentrant { + Signature[] calldata _sigs + ) external { // CHECKS // Check that the valset nonce is greater than the old one - require( - _newValsetNonce > _currentValsetNonce, - "New valset nonce must be greater than the current nonce" - ); + if (_newValset.valsetNonce <= _currentValset.valsetNonce) { + revert InvalidValsetNonce({ + newNonce: _newValset.valsetNonce, + currentNonce: _currentValset.valsetNonce + }); + } + + // Check that the valset nonce is less than a million nonces forward from the old one + // this makes it difficult for an attacker to lock out the contract by getting a single + // bad validator set through with uint256 max nonce + if (_newValset.valsetNonce > _currentValset.valsetNonce + 1000000) { + revert InvalidValsetNonce({ + newNonce: _newValset.valsetNonce, + currentNonce: _currentValset.valsetNonce + }); + } // Check that new validators and powers set is well-formed - require(_newValidators.length == _newPowers.length, "Malformed new validator set"); + if ( + _newValset.validators.length != _newValset.powers.length || + _newValset.validators.length == 0 + ) { + revert MalformedNewValidatorSet(); + } // Check that current validators, powers, and signatures (v,r,s) set is well-formed - require( - _currentValidators.length == _currentPowers.length && - _currentValidators.length == _v.length && - _currentValidators.length == _r.length && - _currentValidators.length == _s.length, - "Malformed current validator set" - ); + validateValset(_currentValset, _sigs); + + // Check cumulative power to ensure the contract has sufficient power to actually + // pass a vote + uint256 cumulativePower = 0; + for (uint256 i = 0; i < _newValset.powers.length; i++) { + cumulativePower = cumulativePower + _newValset.powers[i]; + if (cumulativePower > constant_powerThreshold) { + break; + } + } + if (cumulativePower <= constant_powerThreshold) { + revert InsufficientPower({ + cumulativePower: cumulativePower, + powerThreshold: constant_powerThreshold + }); + } // Check that the supplied current validator set matches the saved checkpoint - require( - makeCheckpoint( - _currentValidators, - _currentPowers, - _currentValsetNonce, - state_gravityId - ) == state_lastValsetCheckpoint, - "Supplied current validators and powers do not match checkpoint." - ); + if (makeCheckpoint(_currentValset, state_gravityId) != state_lastValsetCheckpoint) { + revert IncorrectCheckpoint(); + } // Check that enough current validators have signed off on the new validator set - bytes32 newCheckpoint = - makeCheckpoint(_newValidators, _newPowers, _newValsetNonce, state_gravityId); + bytes32 newCheckpoint = makeCheckpoint(_newValset, state_gravityId); - checkValidatorSignatures( - _currentValidators, - _currentPowers, - _v, - _r, - _s, - newCheckpoint, - state_powerThreshold - ); + checkValidatorSignatures(_currentValset, _sigs, newCheckpoint, constant_powerThreshold); // ACTIONS @@ -273,83 +317,87 @@ contract Gravity is ReentrancyGuard { state_lastValsetCheckpoint = newCheckpoint; // Store new nonce - state_lastValsetNonce = _newValsetNonce; + state_lastValsetNonce = _newValset.valsetNonce; + + // Send submission reward to msg.sender if reward token is a valid value + if (_newValset.rewardToken != address(0) && _newValset.rewardAmount != 0) { + IERC20(_newValset.rewardToken).safeTransfer(msg.sender, _newValset.rewardAmount); + } // LOGS - state_lastEventNonce = state_lastEventNonce.add(1); - emit ValsetUpdatedEvent(_newValsetNonce, state_lastEventNonce, _newValidators, _newPowers); + + state_lastEventNonce = state_lastEventNonce + 1; + emit ValsetUpdatedEvent( + _newValset.valsetNonce, + state_lastEventNonce, + _newValset.rewardAmount, + _newValset.rewardToken, + _newValset.validators, + _newValset.powers + ); } // submitBatch processes a batch of Cosmos -> Ethereum transactions by sending the tokens in the transactions // to the destination addresses. It is approved by the current Cosmos validator set. - // Anyone can call this function, but they must supply valid signatures of state_powerThreshold of the current valset over + // Anyone can call this function, but they must supply valid signatures of constant_powerThreshold of the current valset over // the batch. function submitBatch( // The validators that approve the batch - address[] memory _currentValidators, - uint256[] memory _currentPowers, - uint256 _currentValsetNonce, + ValsetArgs calldata _currentValset, // These are arrays of the parts of the validators signatures - uint8[] memory _v, - bytes32[] memory _r, - bytes32[] memory _s, + Signature[] calldata _sigs, // The batch of transactions - uint256[] memory _amounts, - address[] memory _destinations, - uint256[] memory _fees, + uint256[] calldata _amounts, + address[] calldata _destinations, + uint256[] calldata _fees, uint256 _batchNonce, address _tokenContract, // a block height beyond which this batch is not valid // used to provide a fee-free timeout uint256 _batchTimeout - ) public nonReentrant { + ) external nonReentrant { // CHECKS scoped to reduce stack depth { // Check that the batch nonce is higher than the last nonce for this token - require( - state_lastBatchNonces[_tokenContract] < _batchNonce, - "New batch nonce must be greater than the current nonce" - ); + if (_batchNonce <= state_lastBatchNonces[_tokenContract]) { + revert InvalidBatchNonce({ + newNonce: _batchNonce, + currentNonce: state_lastBatchNonces[_tokenContract] + }); + } + + // Check that the batch nonce is less than one million nonces forward from the old one + // this makes it difficult for an attacker to lock out the contract by getting a single + // bad batch through with uint256 max nonce + if (_batchNonce > state_lastBatchNonces[_tokenContract] + 1000000) { + revert InvalidBatchNonce({ + newNonce: _batchNonce, + currentNonce: state_lastBatchNonces[_tokenContract] + }); + } // Check that the block height is less than the timeout height - require( - block.number < _batchTimeout, - "Batch timeout must be greater than the current block height" - ); + if (block.number >= _batchTimeout) { + revert BatchTimedOut(); + } // Check that current validators, powers, and signatures (v,r,s) set is well-formed - require( - _currentValidators.length == _currentPowers.length && - _currentValidators.length == _v.length && - _currentValidators.length == _r.length && - _currentValidators.length == _s.length, - "Malformed current validator set" - ); + validateValset(_currentValset, _sigs); // Check that the supplied current validator set matches the saved checkpoint - require( - makeCheckpoint( - _currentValidators, - _currentPowers, - _currentValsetNonce, - state_gravityId - ) == state_lastValsetCheckpoint, - "Supplied current validators and powers do not match checkpoint." - ); + if (makeCheckpoint(_currentValset, state_gravityId) != state_lastValsetCheckpoint) { + revert IncorrectCheckpoint(); + } // Check that the transaction batch is well-formed - require( - _amounts.length == _destinations.length && _amounts.length == _fees.length, - "Malformed batch of transactions" - ); + if (_amounts.length != _destinations.length || _amounts.length != _fees.length) { + revert MalformedBatch(); + } // Check that enough current validators have signed off on the transaction batch and valset checkValidatorSignatures( - _currentValidators, - _currentPowers, - _v, - _r, - _s, + _currentValset, + _sigs, // Get hash of the transaction batch and checkpoint keccak256( abi.encode( @@ -364,7 +412,7 @@ contract Gravity is ReentrancyGuard { _batchTimeout ) ), - state_powerThreshold + constant_powerThreshold ); // ACTIONS @@ -377,7 +425,7 @@ contract Gravity is ReentrancyGuard { uint256 totalFee; for (uint256 i = 0; i < _amounts.length; i++) { IERC20(_tokenContract).safeTransfer(_destinations[i], _amounts[i]); - totalFee = totalFee.add(_fees[i]); + totalFee = totalFee + _fees[i]; } // Send transaction fees to msg.sender @@ -387,7 +435,7 @@ contract Gravity is ReentrancyGuard { // LOGS scoped to reduce stack depth { - state_lastEventNonce = state_lastEventNonce.add(1); + state_lastEventNonce = state_lastEventNonce + 1; emit TransactionBatchExecutedEvent(_batchNonce, _tokenContract, state_lastEventNonce); } } @@ -403,61 +451,48 @@ contract Gravity is ReentrancyGuard { // for each call. function submitLogicCall( // The validators that approve the call - address[] memory _currentValidators, - uint256[] memory _currentPowers, - uint256 _currentValsetNonce, + ValsetArgs calldata _currentValset, // These are arrays of the parts of the validators signatures - uint8[] memory _v, - bytes32[] memory _r, - bytes32[] memory _s, + Signature[] calldata _sigs, LogicCallArgs memory _args - ) public nonReentrant { + ) external nonReentrant { // CHECKS scoped to reduce stack depth { // Check that the call has not timed out - require(block.number < _args.timeOut, "Timed out"); + if (block.number >= _args.timeOut) { + revert LogicCallTimedOut(); + } // Check that the invalidation nonce is higher than the last nonce for this invalidation Id - require( - state_invalidationMapping[_args.invalidationId] < _args.invalidationNonce, - "New invalidation nonce must be greater than the current nonce" - ); + if (state_invalidationMapping[_args.invalidationId] >= _args.invalidationNonce) { + revert InvalidLogicCallNonce({ + newNonce: _args.invalidationNonce, + currentNonce: state_invalidationMapping[_args.invalidationId] + }); + } + + // note the lack of nonce skipping check, it's not needed here since an attacker + // will never be able to fill the invalidationId space, therefore a nonce lockout + // is simply not possible // Check that current validators, powers, and signatures (v,r,s) set is well-formed - require( - _currentValidators.length == _currentPowers.length && - _currentValidators.length == _v.length && - _currentValidators.length == _r.length && - _currentValidators.length == _s.length, - "Malformed current validator set" - ); + validateValset(_currentValset, _sigs); // Check that the supplied current validator set matches the saved checkpoint - require( - makeCheckpoint( - _currentValidators, - _currentPowers, - _currentValsetNonce, - state_gravityId - ) == state_lastValsetCheckpoint, - "Supplied current validators and powers do not match checkpoint." - ); + if (makeCheckpoint(_currentValset, state_gravityId) != state_lastValsetCheckpoint) { + revert IncorrectCheckpoint(); + } - // Check that the token transfer list is well-formed - require( - _args.transferAmounts.length == _args.transferTokenContracts.length, - "Malformed list of token transfers" - ); + if (_args.transferAmounts.length != _args.transferTokenContracts.length) { + revert InvalidLogicCallTransfers(); + } - // Check that the fee list is well-formed - require( - _args.feeAmounts.length == _args.feeTokenContracts.length, - "Malformed list of fees" - ); + if (_args.feeAmounts.length != _args.feeTokenContracts.length) { + revert InvalidLogicCallFees(); + } } - - bytes32 argsHash = - keccak256( + { + bytes32 argsHash = keccak256( abi.encode( state_gravityId, // bytes32 encoding of "logicCall" @@ -474,17 +509,13 @@ contract Gravity is ReentrancyGuard { ) ); - { // Check that enough current validators have signed off on the transaction batch and valset checkValidatorSignatures( - _currentValidators, - _currentPowers, - _v, - _r, - _s, + _currentValset, + _sigs, // Get hash of the transaction batch and checkpoint argsHash, - state_powerThreshold + constant_powerThreshold ); } @@ -511,7 +542,7 @@ contract Gravity is ReentrancyGuard { // LOGS scoped to reduce stack depth { - state_lastEventNonce = state_lastEventNonce.add(1); + state_lastEventNonce = state_lastEventNonce + 1; emit LogicCallEvent( _args.invalidationId, _args.invalidationNonce, @@ -523,31 +554,50 @@ contract Gravity is ReentrancyGuard { function sendToCosmos( address _tokenContract, - bytes32 _destination, + string calldata _destination, uint256 _amount - ) public nonReentrant { + ) external nonReentrant { + // we snapshot our current balance of this token + uint256 ourStartingBalance = IERC20(_tokenContract).balanceOf(address(this)); + + // attempt to transfer the user specified amount IERC20(_tokenContract).safeTransferFrom(msg.sender, address(this), _amount); - state_lastEventNonce = state_lastEventNonce.add(1); + + // check what this particular ERC20 implementation actually gave us, since it doesn't + // have to be at all related to the _amount + uint256 ourEndingBalance = IERC20(_tokenContract).balanceOf(address(this)); + + // a very strange ERC20 may trigger this condition, if we didn't have this we would + // underflow, so it's mostly just an error message printer + if (ourEndingBalance <= ourStartingBalance) { + revert InvalidSendToCosmos(); + } + + state_lastEventNonce = state_lastEventNonce + 1; + + // emit to Cosmos the actual amount our balance has changed, rather than the user + // provided amount. This protects against a small set of wonky ERC20 behavior, like + // burning on send but not tokens that for example change every users balance every day. emit SendToCosmosEvent( _tokenContract, msg.sender, _destination, - _amount, + ourEndingBalance - ourStartingBalance, state_lastEventNonce ); } function deployERC20( - string memory _cosmosDenom, - string memory _name, - string memory _symbol, + string calldata _cosmosDenom, + string calldata _name, + string calldata _symbol, uint8 _decimals - ) public { + ) external { // Deploy an ERC20 with entire supply granted to Gravity.sol CosmosERC20 erc20 = new CosmosERC20(address(this), _name, _symbol, _decimals); // Fire an event to let the Cosmos module know - state_lastEventNonce = state_lastEventNonce.add(1); + state_lastEventNonce = state_lastEventNonce + 1; emit ERC20DeployedEvent( _cosmosDenom, address(erc20), @@ -561,41 +611,53 @@ contract Gravity is ReentrancyGuard { constructor( // A unique identifier for this gravity instance to use in signatures bytes32 _gravityId, - // How much voting power is needed to approve operations - uint256 _powerThreshold, - // The validator set + // The validator set, not in valset args format since many of it's + // arguments would never be used in this case address[] memory _validators, uint256[] memory _powers - ) public { + ) { // CHECKS // Check that validators, powers, and signatures (v,r,s) set is well-formed - require(_validators.length == _powers.length, "Malformed current validator set"); + if (_validators.length != _powers.length || _validators.length == 0) { + revert MalformedCurrentValidatorSet(); + } // Check cumulative power to ensure the contract has sufficient power to actually // pass a vote uint256 cumulativePower = 0; for (uint256 i = 0; i < _powers.length; i++) { cumulativePower = cumulativePower + _powers[i]; - if (cumulativePower > _powerThreshold) { + if (cumulativePower > constant_powerThreshold) { break; } } - require( - cumulativePower > _powerThreshold, - "Submitted validator set signatures do not have enough power." - ); + if (cumulativePower <= constant_powerThreshold) { + revert InsufficientPower({ + cumulativePower: cumulativePower, + powerThreshold: constant_powerThreshold + }); + } - bytes32 newCheckpoint = makeCheckpoint(_validators, _powers, 0, _gravityId); + ValsetArgs memory _valset; + _valset = ValsetArgs(_validators, _powers, 0, 0, address(0)); + + bytes32 newCheckpoint = makeCheckpoint(_valset, _gravityId); // ACTIONS state_gravityId = _gravityId; - state_powerThreshold = _powerThreshold; state_lastValsetCheckpoint = newCheckpoint; // LOGS - emit ValsetUpdatedEvent(state_lastValsetNonce, state_lastEventNonce, _validators, _powers); + emit ValsetUpdatedEvent( + state_lastValsetNonce, + state_lastEventNonce, + 0, + address(0), + _validators, + _powers + ); } -} +} \ No newline at end of file diff --git a/contracts/basic-bandwidth-generation/contracts/test-contracts/TestCosmosToken.sol b/contracts/basic-bandwidth-generation/contracts/test-contracts/TestCosmosToken.sol new file mode 100644 index 0000000000..9c88d8defd --- /dev/null +++ b/contracts/basic-bandwidth-generation/contracts/test-contracts/TestCosmosToken.sol @@ -0,0 +1,55 @@ +//SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.10; +import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; + +/** +* This is a slightly modified version of the cosmos erc20 contract +* which I have done for unit testing. +* +* All that has been changed is the MAX_UINT variable to allow +* me to mint some tokens more easily in unit tests, and the +* addition of the public mint() function. +*/ + + +contract TestCosmosERC20 is ERC20 { + /* canonical amount */ + // uint256 MAX_UINT = 2**256 - 1; + + /* unit testing amount */ + uint256 HALF_MAX_UINT = 2**256 / 2; + + uint8 private cosmosDecimals; + address private gravityAddress; + + // This override ensures we return the proper number of decimals + // for the cosmos token + function decimals() public view virtual override returns (uint8) { + return cosmosDecimals; + } + + // This is not an accurate total supply. Instead this is the total supply + // of the given cosmos asset on Ethereum at this moment in time. Keeping + // a totally accurate supply would require constant updates from the Cosmos + // side, while in theory this could be piggy-backed on some existing bridge + // operation it's a lot of complextiy to add so we chose to forgoe it. + function totalSupply() public view virtual override returns (uint256) { + return HALF_MAX_UINT - balanceOf(gravityAddress); + } + + constructor( + address _gravityAddress, + string memory _name, + string memory _symbol, + uint8 _decimals + ) ERC20(_name, _symbol) { + cosmosDecimals = _decimals; + gravityAddress = _gravityAddress; + _mint(_gravityAddress, HALF_MAX_UINT); + } + + // Additional function for our (nym repo) unit tests with bridge + function mintForUnitTesting(address _to, uint _amount) public { + _mint(_to, _amount); + } +} \ No newline at end of file diff --git a/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol b/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol new file mode 100644 index 0000000000..58e52dd83c --- /dev/null +++ b/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol @@ -0,0 +1,671 @@ +//SPDX-License-Identifier: Apache-2.0 +pragma solidity 0.8.10; + +import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; +import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; +import "@openzeppelin/contracts/security/ReentrancyGuard.sol"; +import "@openzeppelin/contracts/utils/Address.sol"; +import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; +import "./TestCosmosToken.sol"; + +/** +* This is a slightly modified version of the gravity bridge contract +* which I have done for unit testing. +* +* All that has been changed is ___ +*/ + +error InvalidSignature(); +error InvalidValsetNonce(uint256 newNonce, uint256 currentNonce); +error InvalidBatchNonce(uint256 newNonce, uint256 currentNonce); +error InvalidLogicCallNonce(uint256 newNonce, uint256 currentNonce); +error InvalidLogicCallTransfers(); +error InvalidLogicCallFees(); +error InvalidSendToCosmos(); +error IncorrectCheckpoint(); +error MalformedNewValidatorSet(); +error MalformedCurrentValidatorSet(); +error MalformedBatch(); +error InsufficientPower(uint256 cumulativePower, uint256 powerThreshold); +error BatchTimedOut(); +error LogicCallTimedOut(); + +// This is being used purely to avoid stack too deep errors +struct LogicCallArgs { + // Transfers out to the logic contract + uint256[] transferAmounts; + address[] transferTokenContracts; + // The fees (transferred to msg.sender) + uint256[] feeAmounts; + address[] feeTokenContracts; + // The arbitrary logic call + address logicContractAddress; + bytes payload; + // Invalidation metadata + uint256 timeOut; + bytes32 invalidationId; + uint256 invalidationNonce; +} + +// This is used purely to avoid stack too deep errors +// represents everything about a given validator set +struct ValsetArgs { + // the validators in this set, represented by an Ethereum address + address[] validators; + // the powers of the given validators in the same order as above + uint256[] powers; + // the nonce of this validator set + uint256 valsetNonce; + // the reward amount denominated in the below reward token, can be + // set to zero + uint256 rewardAmount; + // the reward token, should be set to the zero address if not being used + address rewardToken; +} + +// This represents a validator signature +struct Signature { + uint8 v; + bytes32 r; + bytes32 s; +} + +contract Gravity is ReentrancyGuard { + using SafeERC20 for IERC20; + + // The number of 'votes' required to execute a valset + // update or batch execution, set to 2/3 of 2^32 + uint256 constant constant_powerThreshold = 2863311530; + + // These are updated often + bytes32 public state_lastValsetCheckpoint; + mapping(address => uint256) public state_lastBatchNonces; + mapping(bytes32 => uint256) public state_invalidationMapping; + uint256 public state_lastValsetNonce = 0; + // event nonce zero is reserved by the Cosmos module as a special + // value indicating that no events have yet been submitted + uint256 public state_lastEventNonce = 1; + + // This is set once at initialization + bytes32 public immutable state_gravityId; + + // TransactionBatchExecutedEvent and SendToCosmosEvent both include the field _eventNonce. + // This is incremented every time one of these events is emitted. It is checked by the + // Cosmos module to ensure that all events are received in order, and that none are lost. + // + // ValsetUpdatedEvent does not include the field _eventNonce because it is never submitted to the Cosmos + // module. It is purely for the use of relayers to allow them to successfully submit batches. + event TransactionBatchExecutedEvent( + uint256 indexed _batchNonce, + address indexed _token, + uint256 _eventNonce + ); + event SendToCosmosEvent( + address indexed _tokenContract, + address indexed _sender, + string _destination, + uint256 _amount, + uint256 _eventNonce + ); + event ERC20DeployedEvent( + // FYI: Can't index on a string without doing a bunch of weird stuff + string _cosmosDenom, + address indexed _tokenContract, + string _name, + string _symbol, + uint8 _decimals, + uint256 _eventNonce + ); + event ValsetUpdatedEvent( + uint256 indexed _newValsetNonce, + uint256 _eventNonce, + uint256 _rewardAmount, + address _rewardToken, + address[] _validators, + uint256[] _powers + ); + event LogicCallEvent( + bytes32 _invalidationId, + uint256 _invalidationNonce, + bytes _returnData, + uint256 _eventNonce + ); + + // TEST FIXTURES + // These are here to make it easier to measure gas usage. They should be removed before production + function testMakeCheckpoint(ValsetArgs calldata _valsetArgs, bytes32 _gravityId) external pure { + makeCheckpoint(_valsetArgs, _gravityId); + } + + function testCheckValidatorSignatures( + ValsetArgs calldata _currentValset, + Signature[] calldata _sigs, + bytes32 _theHash, + uint256 _powerThreshold + ) external pure { + checkValidatorSignatures(_currentValset, _sigs, _theHash, _powerThreshold); + } + + // END TEST FIXTURES + + function lastBatchNonce(address _erc20Address) external view returns (uint256) { + return state_lastBatchNonces[_erc20Address]; + } + + function lastLogicCallNonce(bytes32 _invalidation_id) external view returns (uint256) { + return state_invalidationMapping[_invalidation_id]; + } + + // Utility function to verify geth style signatures + function verifySig( + address _signer, + bytes32 _theHash, + Signature calldata _sig + ) private pure returns (bool) { + bytes32 messageDigest = keccak256( + abi.encodePacked("\x19Ethereum Signed Message:\n32", _theHash) + ); + return _signer == ECDSA.recover(messageDigest, _sig.v, _sig.r, _sig.s); + } + + // Utility function to determine that a validator set and signatures are well formed + function validateValset(ValsetArgs calldata _valset, Signature[] calldata _sigs) private pure { + // Check that current validators, powers, and signatures (v,r,s) set is well-formed + if ( + _valset.validators.length != _valset.powers.length || + _valset.validators.length != _sigs.length + ) { + revert MalformedCurrentValidatorSet(); + } + } + + // Make a new checkpoint from the supplied validator set + // A checkpoint is a hash of all relevant information about the valset. This is stored by the contract, + // instead of storing the information directly. This saves on storage and gas. + // The format of the checkpoint is: + // h(gravityId, "checkpoint", valsetNonce, validators[], powers[]) + // Where h is the keccak256 hash function. + // The validator powers must be decreasing or equal. This is important for checking the signatures on the + // next valset, since it allows the caller to stop verifying signatures once a quorum of signatures have been verified. + function makeCheckpoint(ValsetArgs memory _valsetArgs, bytes32 _gravityId) + private + pure + returns (bytes32) + { + // bytes32 encoding of the string "checkpoint" + bytes32 methodName = 0x636865636b706f696e7400000000000000000000000000000000000000000000; + + bytes32 checkpoint = keccak256( + abi.encode( + _gravityId, + methodName, + _valsetArgs.valsetNonce, + _valsetArgs.validators, + _valsetArgs.powers, + _valsetArgs.rewardAmount, + _valsetArgs.rewardToken + ) + ); + + return checkpoint; + } + + function checkValidatorSignatures( + // The current validator set and their powers + ValsetArgs calldata _currentValset, + // The current validator's signatures + Signature[] calldata _sigs, + // This is what we are checking they have signed + bytes32 _theHash, + uint256 _powerThreshold + ) private pure { + uint256 cumulativePower = 0; + + for (uint256 i = 0; i < _currentValset.validators.length; i++) { + // If v is set to 0, this signifies that it was not possible to get a signature from this validator and we skip evaluation + // (In a valid signature, it is either 27 or 28) + if (_sigs[i].v != 0) { + // Check that the current validator has signed off on the hash + if (!verifySig(_currentValset.validators[i], _theHash, _sigs[i])) { + revert InvalidSignature(); + } + + // Sum up cumulative power + cumulativePower = cumulativePower + _currentValset.powers[i]; + + // Break early to avoid wasting gas + if (cumulativePower > _powerThreshold) { + break; + } + } + } + + // Check that there was enough power + if (cumulativePower <= _powerThreshold) { + revert InsufficientPower(cumulativePower, _powerThreshold); + } + // Success + } + + // This updates the valset by checking that the validators in the current valset have signed off on the + // new valset. The signatures supplied are the signatures of the current valset over the checkpoint hash + // generated from the new valset. + // Anyone can call this function, but they must supply valid signatures of constant_powerThreshold of the current valset over + // the new valset. + function updateValset( + // The new version of the validator set + ValsetArgs calldata _newValset, + // The current validators that approve the change + ValsetArgs calldata _currentValset, + // These are arrays of the parts of the current validator's signatures + Signature[] calldata _sigs + ) external { + // CHECKS + + // Check that the valset nonce is greater than the old one + if (_newValset.valsetNonce <= _currentValset.valsetNonce) { + revert InvalidValsetNonce({ + newNonce: _newValset.valsetNonce, + currentNonce: _currentValset.valsetNonce + }); + } + + // Check that the valset nonce is less than a million nonces forward from the old one + // this makes it difficult for an attacker to lock out the contract by getting a single + // bad validator set through with uint256 max nonce + if (_newValset.valsetNonce > _currentValset.valsetNonce + 1000000) { + revert InvalidValsetNonce({ + newNonce: _newValset.valsetNonce, + currentNonce: _currentValset.valsetNonce + }); + } + + // Check that new validators and powers set is well-formed + if ( + _newValset.validators.length != _newValset.powers.length || + _newValset.validators.length == 0 + ) { + revert MalformedNewValidatorSet(); + } + + // Check that current validators, powers, and signatures (v,r,s) set is well-formed + validateValset(_currentValset, _sigs); + + // Check cumulative power to ensure the contract has sufficient power to actually + // pass a vote + uint256 cumulativePower = 0; + for (uint256 i = 0; i < _newValset.powers.length; i++) { + cumulativePower = cumulativePower + _newValset.powers[i]; + if (cumulativePower > constant_powerThreshold) { + break; + } + } + if (cumulativePower <= constant_powerThreshold) { + revert InsufficientPower({ + cumulativePower: cumulativePower, + powerThreshold: constant_powerThreshold + }); + } + + // Check that the supplied current validator set matches the saved checkpoint + if (makeCheckpoint(_currentValset, state_gravityId) != state_lastValsetCheckpoint) { + revert IncorrectCheckpoint(); + } + + // Check that enough current validators have signed off on the new validator set + bytes32 newCheckpoint = makeCheckpoint(_newValset, state_gravityId); + + checkValidatorSignatures(_currentValset, _sigs, newCheckpoint, constant_powerThreshold); + + // ACTIONS + + // Stored to be used next time to validate that the valset + // supplied by the caller is correct. + state_lastValsetCheckpoint = newCheckpoint; + + // Store new nonce + state_lastValsetNonce = _newValset.valsetNonce; + + // Send submission reward to msg.sender if reward token is a valid value + if (_newValset.rewardToken != address(0) && _newValset.rewardAmount != 0) { + IERC20(_newValset.rewardToken).safeTransfer(msg.sender, _newValset.rewardAmount); + } + + // LOGS + + state_lastEventNonce = state_lastEventNonce + 1; + emit ValsetUpdatedEvent( + _newValset.valsetNonce, + state_lastEventNonce, + _newValset.rewardAmount, + _newValset.rewardToken, + _newValset.validators, + _newValset.powers + ); + } + + // submitBatch processes a batch of Cosmos -> Ethereum transactions by sending the tokens in the transactions + // to the destination addresses. It is approved by the current Cosmos validator set. + // Anyone can call this function, but they must supply valid signatures of constant_powerThreshold of the current valset over + // the batch. + function submitBatch( + // The validators that approve the batch + ValsetArgs calldata _currentValset, + // These are arrays of the parts of the validators signatures + Signature[] calldata _sigs, + // The batch of transactions + uint256[] calldata _amounts, + address[] calldata _destinations, + uint256[] calldata _fees, + uint256 _batchNonce, + address _tokenContract, + // a block height beyond which this batch is not valid + // used to provide a fee-free timeout + uint256 _batchTimeout + ) external nonReentrant { + // CHECKS scoped to reduce stack depth + { + // Check that the batch nonce is higher than the last nonce for this token + if (_batchNonce <= state_lastBatchNonces[_tokenContract]) { + revert InvalidBatchNonce({ + newNonce: _batchNonce, + currentNonce: state_lastBatchNonces[_tokenContract] + }); + } + + // Check that the batch nonce is less than one million nonces forward from the old one + // this makes it difficult for an attacker to lock out the contract by getting a single + // bad batch through with uint256 max nonce + if (_batchNonce > state_lastBatchNonces[_tokenContract] + 1000000) { + revert InvalidBatchNonce({ + newNonce: _batchNonce, + currentNonce: state_lastBatchNonces[_tokenContract] + }); + } + + // Check that the block height is less than the timeout height + if (block.number >= _batchTimeout) { + revert BatchTimedOut(); + } + + // Check that current validators, powers, and signatures (v,r,s) set is well-formed + validateValset(_currentValset, _sigs); + + // Check that the supplied current validator set matches the saved checkpoint + if (makeCheckpoint(_currentValset, state_gravityId) != state_lastValsetCheckpoint) { + revert IncorrectCheckpoint(); + } + + // Check that the transaction batch is well-formed + if (_amounts.length != _destinations.length || _amounts.length != _fees.length) { + revert MalformedBatch(); + } + + // Check that enough current validators have signed off on the transaction batch and valset + checkValidatorSignatures( + _currentValset, + _sigs, + // Get hash of the transaction batch and checkpoint + keccak256( + abi.encode( + state_gravityId, + // bytes32 encoding of "transactionBatch" + 0x7472616e73616374696f6e426174636800000000000000000000000000000000, + _amounts, + _destinations, + _fees, + _batchNonce, + _tokenContract, + _batchTimeout + ) + ), + constant_powerThreshold + ); + + // ACTIONS + + // Store batch nonce + state_lastBatchNonces[_tokenContract] = _batchNonce; + + { + // Send transaction amounts to destinations + uint256 totalFee; + for (uint256 i = 0; i < _amounts.length; i++) { + IERC20(_tokenContract).safeTransfer(_destinations[i], _amounts[i]); + totalFee = totalFee + _fees[i]; + } + + // Send transaction fees to msg.sender + IERC20(_tokenContract).safeTransfer(msg.sender, totalFee); + } + } + + // LOGS scoped to reduce stack depth + { + state_lastEventNonce = state_lastEventNonce + 1; + emit TransactionBatchExecutedEvent(_batchNonce, _tokenContract, state_lastEventNonce); + } + } + + // This makes calls to contracts that execute arbitrary logic + // First, it gives the logic contract some tokens + // Then, it gives msg.senders tokens for fees + // Then, it calls an arbitrary function on the logic contract + // invalidationId and invalidationNonce are used for replay prevention. + // They can be used to implement a per-token nonce by setting the token + // address as the invalidationId and incrementing the nonce each call. + // They can be used for nonce-free replay prevention by using a different invalidationId + // for each call. + function submitLogicCall( + // The validators that approve the call + ValsetArgs calldata _currentValset, + // These are arrays of the parts of the validators signatures + Signature[] calldata _sigs, + LogicCallArgs memory _args + ) external nonReentrant { + // CHECKS scoped to reduce stack depth + { + // Check that the call has not timed out + if (block.number >= _args.timeOut) { + revert LogicCallTimedOut(); + } + + // Check that the invalidation nonce is higher than the last nonce for this invalidation Id + if (state_invalidationMapping[_args.invalidationId] >= _args.invalidationNonce) { + revert InvalidLogicCallNonce({ + newNonce: _args.invalidationNonce, + currentNonce: state_invalidationMapping[_args.invalidationId] + }); + } + + // note the lack of nonce skipping check, it's not needed here since an attacker + // will never be able to fill the invalidationId space, therefore a nonce lockout + // is simply not possible + + // Check that current validators, powers, and signatures (v,r,s) set is well-formed + validateValset(_currentValset, _sigs); + + // Check that the supplied current validator set matches the saved checkpoint + if (makeCheckpoint(_currentValset, state_gravityId) != state_lastValsetCheckpoint) { + revert IncorrectCheckpoint(); + } + + if (_args.transferAmounts.length != _args.transferTokenContracts.length) { + revert InvalidLogicCallTransfers(); + } + + if (_args.feeAmounts.length != _args.feeTokenContracts.length) { + revert InvalidLogicCallFees(); + } + } + { + bytes32 argsHash = keccak256( + abi.encode( + state_gravityId, + // bytes32 encoding of "logicCall" + 0x6c6f67696343616c6c0000000000000000000000000000000000000000000000, + _args.transferAmounts, + _args.transferTokenContracts, + _args.feeAmounts, + _args.feeTokenContracts, + _args.logicContractAddress, + _args.payload, + _args.timeOut, + _args.invalidationId, + _args.invalidationNonce + ) + ); + + // Check that enough current validators have signed off on the transaction batch and valset + checkValidatorSignatures( + _currentValset, + _sigs, + // Get hash of the transaction batch and checkpoint + argsHash, + constant_powerThreshold + ); + } + + // ACTIONS + + // Update invaldiation nonce + state_invalidationMapping[_args.invalidationId] = _args.invalidationNonce; + + // Send tokens to the logic contract + for (uint256 i = 0; i < _args.transferAmounts.length; i++) { + IERC20(_args.transferTokenContracts[i]).safeTransfer( + _args.logicContractAddress, + _args.transferAmounts[i] + ); + } + + // Make call to logic contract + bytes memory returnData = Address.functionCall(_args.logicContractAddress, _args.payload); + + // Send fees to msg.sender + for (uint256 i = 0; i < _args.feeAmounts.length; i++) { + IERC20(_args.feeTokenContracts[i]).safeTransfer(msg.sender, _args.feeAmounts[i]); + } + + // LOGS scoped to reduce stack depth + { + state_lastEventNonce = state_lastEventNonce + 1; + emit LogicCallEvent( + _args.invalidationId, + _args.invalidationNonce, + returnData, + state_lastEventNonce + ); + } + } + + function sendToCosmos( + address _tokenContract, + string calldata _destination, + uint256 _amount + ) external nonReentrant { + // we snapshot our current balance of this token + uint256 ourStartingBalance = IERC20(_tokenContract).balanceOf(address(this)); + + // attempt to transfer the user specified amount + IERC20(_tokenContract).safeTransferFrom(msg.sender, address(this), _amount); + + // check what this particular ERC20 implementation actually gave us, since it doesn't + // have to be at all related to the _amount + uint256 ourEndingBalance = IERC20(_tokenContract).balanceOf(address(this)); + + // a very strange ERC20 may trigger this condition, if we didn't have this we would + // underflow, so it's mostly just an error message printer + if (ourEndingBalance <= ourStartingBalance) { + revert InvalidSendToCosmos(); + } + + state_lastEventNonce = state_lastEventNonce + 1; + + // emit to Cosmos the actual amount our balance has changed, rather than the user + // provided amount. This protects against a small set of wonky ERC20 behavior, like + // burning on send but not tokens that for example change every users balance every day. + emit SendToCosmosEvent( + _tokenContract, + msg.sender, + _destination, + ourEndingBalance - ourStartingBalance, + state_lastEventNonce + ); + } + + function deployERC20( + string calldata _cosmosDenom, + string calldata _name, + string calldata _symbol, + uint8 _decimals + ) external { + // NOTE this is an edit made for the nym codebase unit tests - in the canonical bridge it is the entire token supply + // Deploy an ERC20 with half of entire supply granted to Gravity.sol + TestCosmosERC20 erc20 = new TestCosmosERC20(address(this), _name, _symbol, _decimals); + + // Fire an event to let the Cosmos module know + state_lastEventNonce = state_lastEventNonce + 1; + emit ERC20DeployedEvent( + _cosmosDenom, + address(erc20), + _name, + _symbol, + _decimals, + state_lastEventNonce + ); + } + + constructor( + // A unique identifier for this gravity instance to use in signatures + bytes32 _gravityId, + // The validator set, not in valset args format since many of it's + // arguments would never be used in this case + address[] memory _validators, + uint256[] memory _powers + ) { + // CHECKS + + // Check that validators, powers, and signatures (v,r,s) set is well-formed + if (_validators.length != _powers.length || _validators.length == 0) { + revert MalformedCurrentValidatorSet(); + } + + // Check cumulative power to ensure the contract has sufficient power to actually + // pass a vote + uint256 cumulativePower = 0; + for (uint256 i = 0; i < _powers.length; i++) { + cumulativePower = cumulativePower + _powers[i]; + if (cumulativePower > constant_powerThreshold) { + break; + } + } + if (cumulativePower <= constant_powerThreshold) { + revert InsufficientPower({ + cumulativePower: cumulativePower, + powerThreshold: constant_powerThreshold + }); + } + + ValsetArgs memory _valset; + _valset = ValsetArgs(_validators, _powers, 0, 0, address(0)); + + bytes32 newCheckpoint = makeCheckpoint(_valset, _gravityId); + + // ACTIONS + + state_gravityId = _gravityId; + state_lastValsetCheckpoint = newCheckpoint; + + // LOGS + + emit ValsetUpdatedEvent( + state_lastValsetNonce, + state_lastEventNonce, + 0, + address(0), + _validators, + _powers + ); + } +} \ No newline at end of file diff --git a/contracts/basic-bandwidth-generation/hardhat.config.js b/contracts/basic-bandwidth-generation/hardhat.config.js index f3e7fbb0cb..4b2c6cbb68 100644 --- a/contracts/basic-bandwidth-generation/hardhat.config.js +++ b/contracts/basic-bandwidth-generation/hardhat.config.js @@ -8,15 +8,15 @@ require('dotenv').config({ path: require('find-config')('.env') }); */ module.exports = { solidity: { - version: "0.6.6", + version: "0.8.10", settings: { optimizer: { enabled: true } } }, - paths: { - artifacts: "./artifacts/contracts" - }, + // paths: { + // artifacts: "./artifacts/contracts" + // }, networks: { // rinkeby: { // url: process.env.RINKEBY_URL, //Infura url with projectId diff --git a/contracts/basic-bandwidth-generation/package-lock.json b/contracts/basic-bandwidth-generation/package-lock.json index 110d9ce2e9..ff7cc4bb1f 100644 --- a/contracts/basic-bandwidth-generation/package-lock.json +++ b/contracts/basic-bandwidth-generation/package-lock.json @@ -1556,9 +1556,9 @@ } }, "@openzeppelin/contracts": { - "version": "4.4.1", - "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.4.1.tgz", - "integrity": "sha512-o+pHCf/yMLSlV5MkDQEzEQL402i6SoRnktru+0rdSxVEFZcTzzGhZCAtZjUFyKGazMSv1TilzMg+RbED1N8XHQ==" + "version": "4.3.1", + "resolved": "https://registry.npmjs.org/@openzeppelin/contracts/-/contracts-4.3.1.tgz", + "integrity": "sha512-QjgbPPlmDK2clK1hzjw2ROfY8KA5q+PfhDUUxZFEBCZP9fi6d5FuNoh/Uq0oCTMEKPmue69vhX2jcl0N/tFKGw==" }, "@openzeppelin/test-helpers": { "version": "0.5.15", diff --git a/contracts/basic-bandwidth-generation/package.json b/contracts/basic-bandwidth-generation/package.json index 933fd6e4e7..14503ac52e 100644 --- a/contracts/basic-bandwidth-generation/package.json +++ b/contracts/basic-bandwidth-generation/package.json @@ -12,7 +12,7 @@ "dependencies": { "@nomiclabs/hardhat-truffle5": "^2.0.2", "@nomiclabs/hardhat-web3": "^2.0.0", - "@openzeppelin/contracts": "^4.3.2", + "@openzeppelin/contracts": "4.3.1", "@openzeppelin/test-helpers": "^0.5.15", "dotenv": "^10.0.0", "find-config": "^1.0.0" From b1f4ae434a95f4169e95b319e7db82cb89a75f2f Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 10 Jan 2022 13:26:49 +0100 Subject: [PATCH 03/73] updated test to use test contract versions --- .../token/ERC20/ERC20.sol/ERC20.dbg.json | 2 +- .../token/ERC20/IERC20.sol/IERC20.dbg.json | 2 +- .../IERC20Metadata.dbg.json | 2 +- .../utils/Context.sol/Context.dbg.json | 2 +- .../cache/solidity-files-cache.json | 10 +++--- .../contracts/BandwidthGenerator.sol | 2 +- .../contracts/test-contracts/TestGravity.sol | 2 +- .../test/BandwidthGenerator.js | 33 ++++++++++--------- 8 files changed, 28 insertions(+), 27 deletions(-) diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json index fd02eec0ea..aa8cbd790e 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/b4e7ec2fd35748689d35a44cde08a2e7.json" + "buildInfo": "../../../../../build-info/e1b958725c1d5919797e36f0f70bc832.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json index fd02eec0ea..aa8cbd790e 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/b4e7ec2fd35748689d35a44cde08a2e7.json" + "buildInfo": "../../../../../build-info/e1b958725c1d5919797e36f0f70bc832.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json index e4bc7fc277..7b717081d4 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../../build-info/b4e7ec2fd35748689d35a44cde08a2e7.json" + "buildInfo": "../../../../../../build-info/e1b958725c1d5919797e36f0f70bc832.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json index bdcb1a5fdf..2dd3eaa178 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/b4e7ec2fd35748689d35a44cde08a2e7.json" + "buildInfo": "../../../../build-info/e1b958725c1d5919797e36f0f70bc832.json" } diff --git a/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json b/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json index f653f82935..7367e1811f 100644 --- a/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json +++ b/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json @@ -2,8 +2,8 @@ "_format": "hh-sol-cache-2", "files": { "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol": { - "lastModificationDate": 1641813499577, - "contentHash": "019fffdd8521017f63b3e923d292c025", + "lastModificationDate": 1641816859262, + "contentHash": "7637957db2593564c0135f527db4673b", "sourceName": "contracts/BandwidthGenerator.sol", "solcConfig": { "version": "0.8.10", @@ -505,8 +505,8 @@ ] }, "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol": { - "lastModificationDate": 1641813465624, - "contentHash": "5c725464b149a3862c88db62891d8f66", + "lastModificationDate": 1641815710987, + "contentHash": "f24299c3acb20aff23914e16b7ba95e1", "sourceName": "contracts/test-contracts/TestGravity.sol", "solcConfig": { "version": "0.8.10", @@ -542,7 +542,7 @@ "0.8.10" ], "artifacts": [ - "Gravity" + "TestGravity" ] } } diff --git a/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol b/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol index ba1b7d587a..1a5aa7ff22 100644 --- a/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol +++ b/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol @@ -65,7 +65,7 @@ contract BandwidthGenerator is Ownable { * @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 memory _cosmosRecipient) public { + function generateBasicBandwidthCredential(uint256 _amount, uint256 _verificationKey, bytes memory _signedVerificationKey, string calldata _cosmosRecipient) public { require(_signedVerificationKey.length == 64, "BandwidthGenerator: Signature doesn't have 64 bytes"); erc20.transferFrom(msg.sender, address(this), _amount); erc20.approve(address(gravityBridge), _amount); diff --git a/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol b/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol index 58e52dd83c..3ac41eac39 100644 --- a/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol +++ b/contracts/basic-bandwidth-generation/contracts/test-contracts/TestGravity.sol @@ -70,7 +70,7 @@ struct Signature { bytes32 s; } -contract Gravity is ReentrancyGuard { +contract TestGravity is ReentrancyGuard { using SafeERC20 for IERC20; // The number of 'votes' required to execute a valset diff --git a/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js b/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js index ce36ec90f9..c2ccf287f7 100644 --- a/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js +++ b/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js @@ -3,8 +3,8 @@ const { constants, expectRevert, expectEvent } = require('@openzeppelin/test-hel const { artifacts, web3 } = require("hardhat"); const BN = require('bn.js'); const BandwidthGenerator = artifacts.require('BandwidthGenerator'); -const Gravity = artifacts.require('Gravity'); -const CosmosToken = artifacts.require('CosmosERC20'); +const Gravity = artifacts.require('test-contracts/TestGravity'); +const CosmosToken = artifacts.require('TestCosmosERC20'); contract('BandwidthGenerator', (accounts) => { @@ -13,6 +13,7 @@ contract('BandwidthGenerator', (accounts) => { let erc20token; let owner = accounts[0]; let user = accounts[1]; + 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 @@ -25,14 +26,13 @@ contract('BandwidthGenerator', (accounts) => { // deploy gravity bridge with test data gravity = await Gravity.new( constants.ZERO_BYTES32, - 1, [owner], - [10] + [2863311531] ); // deploy erc20 NYM from bridge await gravity.deployERC20( - 'eNYM', + 'cosmosNYMDenomination', 'NYMERC20', 'NYM', 6 @@ -49,6 +49,7 @@ contract('BandwidthGenerator', (accounts) => { // deploy bandwidthGenerator contract with contract address of erc20NYM & address of gravity bridge bandwidthGenerator = await BandwidthGenerator.new(erc20token.address, gravity.address); + }); context(">> deployment parameters are valid", () => { @@ -82,7 +83,7 @@ contract('BandwidthGenerator', (accounts) => { }); context(">> generateBasicBandwidthCredential()", () => { - before("", async () => { + before("mint tokens & approve", async () => { // transfer tokens to account which will create a BBCredential await erc20token.mintForUnitTesting(user, tokenAmount); // approve transfer to contract @@ -95,7 +96,7 @@ contract('BandwidthGenerator', (accounts) => { 15, [0x39, 0x53, 0x0a, 0x00, 0xea, 0xe2, 0xa5, 0xaa, 0xc8, 0x14, 0x42, 0x09, 0xcc, 0xac, 0x91, 0x7a, 0xe5, 0x6b, 0xf4, 0xa9, 0x58, 0x95, 0x44, 0xcb, 0x00, 0x20, 0xf9, 0x2f, 0xee, 0x35, 0xa3, 0xba, 0x39, 0x53, 0x0a, 0x00, 0xea, 0xe2, 0xa5, 0xaa, 0xc8, 0x14, 0x42, 0x09, 0xcc, 0xac, 0x91, 0x7a, 0xe5, 0x6b, 0xf4, 0xa9, 0x58, 0x95, 0x44, 0xcb, 0x00, 0x20, 0xf9, 0x2f, 0xee, 0x35, 0xa3, 0xba], - constants.ZERO_BYTES32, + cosmosRecipient, { from: user } ); @@ -105,7 +106,7 @@ contract('BandwidthGenerator', (accounts) => { Bandwidth: expectedBandwidthInMB.toString(), VerificationKey: '15', SignedVerificationKey: '0x39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba', - CosmosRecipient: constants.ZERO_BYTES32 + // CosmosRecipient: cosmosRecipient }); await expectEvent.inTransaction(tx.tx, erc20token, 'Transfer', { @@ -116,7 +117,7 @@ contract('BandwidthGenerator', (accounts) => { await expectEvent.inTransaction(tx.tx, gravity, 'SendToCosmosEvent', { _tokenContract: erc20token.address, _sender: bandwidthGenerator.address, - _destination: constants.ZERO_BYTES32, + _destination: cosmosRecipient, _amount: halfTokenAmount }); @@ -133,7 +134,7 @@ contract('BandwidthGenerator', (accounts) => { 15, [0x39, 0x53, 0x0a, 0x00, 0xea, 0xe2, 0xa5, 0xaa, 0xc8, 0x14, 0x42, 0x09, 0xcc, 0xac, 0x91, 0x7a, 0xe5, 0x6b, 0xf4, 0xa9, 0x58, 0x95, 0x44, 0xcb, 0x00, 0x20, 0xf9, 0x2f, 0xee, 0x35, 0xa3, 0xba, 0x39, 0x53, 0x0a, 0x00, 0xea, 0xe2, 0xa5, 0xaa, 0xc8, 0x14, 0x42, 0x09, 0xcc, 0xac, 0x91, 0x7a, 0xe5, 0x6b, 0xf4, 0xa9, 0x58, 0x95, 0x44, 0xcb, 0x00, 0x20, 0xf9, 0x2f, 0xee, 0x35, 0xa3, 0xba], - constants.ZERO_BYTES32, + cosmosRecipient, { from: user } ); @@ -143,7 +144,7 @@ contract('BandwidthGenerator', (accounts) => { Bandwidth: newexpectedBandwidthInMB.toString(), VerificationKey: '15', SignedVerificationKey: '0x39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba', - CosmosRecipient: constants.ZERO_BYTES32 + // CosmosRecipient: cosmosRecipient }); await expectEvent.inTransaction(tx.tx, erc20token, 'Transfer', { @@ -154,7 +155,7 @@ contract('BandwidthGenerator', (accounts) => { await expectEvent.inTransaction(tx.tx, gravity, 'SendToCosmosEvent', { _tokenContract: erc20token.address, _sender: bandwidthGenerator.address, - _destination: constants.ZERO_BYTES32, + _destination: cosmosRecipient, _amount: unevenTokenAmount }); }); @@ -168,7 +169,7 @@ contract('BandwidthGenerator', (accounts) => { 16, [0x0a, 0x00, 0xea, 0xe2, 0xa5, 0xaa, 0xc8, 0x14, 0x42, 0x09, 0xcc, 0xac, 0x91, 0x7a, 0xe5, 0x6b, 0xf4, 0xa9, 0x58, 0x95, 0x44, 0xcb, 0x00, 0x20, 0xf9, 0x2f, 0xee, 0x35, 0xa3, 0xba, 0x39, 0x53, 0x0a, 0x00, 0xea, 0xe2, 0xa5, 0xaa, 0xc8, 0x14, 0x42, 0x09, 0xcc, 0xac, 0x91, 0x7a, 0xe5, 0x6b, 0xf4, 0xa9, 0x58, 0x95, 0x44, 0xcb, 0x00, 0x20, 0xf9, 0x2f, 0xee, 0x35, 0xa3, 0xba], - constants.ZERO_BYTES32, + cosmosRecipient, { from: user } ), "BandwidthGenerator: Signature doesn't have 64 bytes" ); @@ -196,7 +197,7 @@ contract('BandwidthGenerator', (accounts) => { 15, [0x39, 0x53, 0x0a, 0x00, 0xea, 0xe2, 0xa5, 0xaa, 0xc8, 0x14, 0x42, 0x09, 0xcc, 0xac, 0x91, 0x7a, 0xe5, 0x6b, 0xf4, 0xa9, 0x58, 0x95, 0x44, 0xcb, 0x00, 0x20, 0xf9, 0x2f, 0xee, 0x35, 0xa3, 0xba, 0x39, 0x53, 0x0a, 0x00, 0xea, 0xe2, 0xa5, 0xaa, 0xc8, 0x14, 0x42, 0x09, 0xcc, 0xac, 0x91, 0x7a, 0xe5, 0x6b, 0xf4, 0xa9, 0x58, 0x95, 0x44, 0xcb, 0x00, 0x20, 0xf9, 0x2f, 0xee, 0x35, 0xa3, 0xba], - constants.ZERO_BYTES32, + cosmosRecipient, { from: user } ); @@ -206,7 +207,7 @@ contract('BandwidthGenerator', (accounts) => { Bandwidth: expectedBandwidthInMB.toString(), VerificationKey: '15', SignedVerificationKey: '0x39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba', - CosmosRecipient: constants.ZERO_BYTES32 + // CosmosRecipient: cosmosRecipient }); await expectEvent.inTransaction(tx.tx, erc20token, 'Transfer', { @@ -217,7 +218,7 @@ contract('BandwidthGenerator', (accounts) => { await expectEvent.inTransaction(tx.tx, gravity, 'SendToCosmosEvent', { _tokenContract: erc20token.address, _sender: bandwidthGenerator.address, - _destination: constants.ZERO_BYTES32, + _destination: cosmosRecipient, _amount: oneToken }); }); From 6d09e6fa7cc8456d30a6bc8001efa6e650050005 Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 10 Jan 2022 14:43:48 +0100 Subject: [PATCH 04/73] updated configs + dependencies --- .../hardhat.config.js | 13 +- .../package-lock.json | 1786 +++++++++++++++-- .../basic-bandwidth-generation/package.json | 5 +- 3 files changed, 1638 insertions(+), 166 deletions(-) diff --git a/contracts/basic-bandwidth-generation/hardhat.config.js b/contracts/basic-bandwidth-generation/hardhat.config.js index 4b2c6cbb68..b07c93d49e 100644 --- a/contracts/basic-bandwidth-generation/hardhat.config.js +++ b/contracts/basic-bandwidth-generation/hardhat.config.js @@ -1,6 +1,7 @@ require("@nomiclabs/hardhat-etherscan"); require("@nomiclabs/hardhat-truffle5"); require("@nomiclabs/hardhat-web3"); +require("@nomiclabs/hardhat-ethers"); require('dotenv').config({ path: require('find-config')('.env') }); /** @@ -18,12 +19,12 @@ module.exports = { // artifacts: "./artifacts/contracts" // }, networks: { - // rinkeby: { - // url: process.env.RINKEBY_URL, //Infura url with projectId - // accounts: [process.env.PRIV_KEY], // private key of account used for contract interaction - // gas: "auto", - // gasPrice: "auto" - // }, + rinkeby: { + url: process.env.RINKEBY_URL, //Infura url with projectId + accounts: [process.env.PRIV_KEY], // private key of account used for contract interaction + gas: "auto", + gasPrice: "auto" + }, }, etherscan: { // Your API key for Etherscan diff --git a/contracts/basic-bandwidth-generation/package-lock.json b/contracts/basic-bandwidth-generation/package-lock.json index ff7cc4bb1f..d05d4eca51 100644 --- a/contracts/basic-bandwidth-generation/package-lock.json +++ b/contracts/basic-bandwidth-generation/package-lock.json @@ -625,6 +625,7 @@ "version": "5.4.1", "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.4.1.tgz", "integrity": "sha512-9mhbjUk76BiSluiiW4BaYyI58KSbDMMQpCLdsAR+RsT2GyATiNYxVv+pGWRrekmsIdY3I+hOqsYQSTkc8L/mcg==", + "dev": true, "requires": { "@ethersproject/address": "^5.4.0", "@ethersproject/bignumber": "^5.4.0", @@ -684,12 +685,35 @@ } }, "@ethersproject/basex": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.4.0.tgz", - "integrity": "sha512-J07+QCVJ7np2bcpxydFVf/CuYo9mZ7T73Pe7KQY4c1lRlrixMeblauMxHXD0MPwFmUHZIILDNViVkykFBZylbg==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.5.0.tgz", + "integrity": "sha512-ZIodwhHpVJ0Y3hUCfUucmxKsWQA5TMnavp5j/UOuDdzZWzJlRmuOjcTMIGgHCYuZmHt36BfiSyQPSRskPxbfaQ==", "requires": { - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/properties": "^5.4.0" + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + }, + "dependencies": { + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + }, + "@ethersproject/properties": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", + "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + } } }, "@ethersproject/bignumber": { @@ -719,20 +743,220 @@ } }, "@ethersproject/contracts": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.4.1.tgz", - "integrity": "sha512-m+z2ZgPy4pyR15Je//dUaymRUZq5MtDajF6GwFbGAVmKz/RF+DNIPwF0k5qEcL3wPGVqUjFg2/krlCRVTU4T5w==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.5.0.tgz", + "integrity": "sha512-2viY7NzyvJkh+Ug17v7g3/IJC8HqZBDcOjYARZLdzRxrfGlRgmYgl6xPRKVbEzy1dWKw/iv7chDcS83pg6cLxg==", "requires": { - "@ethersproject/abi": "^5.4.0", - "@ethersproject/abstract-provider": "^5.4.0", - "@ethersproject/abstract-signer": "^5.4.0", - "@ethersproject/address": "^5.4.0", - "@ethersproject/bignumber": "^5.4.0", - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/constants": "^5.4.0", - "@ethersproject/logger": "^5.4.0", - "@ethersproject/properties": "^5.4.0", - "@ethersproject/transactions": "^5.4.0" + "@ethersproject/abi": "^5.5.0", + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0" + }, + "dependencies": { + "@ethersproject/abi": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.5.0.tgz", + "integrity": "sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w==", + "requires": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/hash": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "@ethersproject/abstract-provider": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", + "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", + "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "requires": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + } + }, + "@ethersproject/address": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", + "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/rlp": "^5.5.0" + } + }, + "@ethersproject/base64": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", + "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "requires": { + "@ethersproject/bytes": "^5.5.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "requires": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "@ethersproject/hash": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", + "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", + "requires": { + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", + "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + }, + "@ethersproject/networks": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/properties": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", + "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/rlp": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", + "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", + "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "bn.js": "^4.11.9", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "@ethersproject/strings": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", + "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/transactions": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", + "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "requires": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0" + } + }, + "@ethersproject/web": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "requires": { + "@ethersproject/base64": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + } } }, "@ethersproject/hash": { @@ -751,42 +975,380 @@ } }, "@ethersproject/hdnode": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.4.0.tgz", - "integrity": "sha512-pKxdS0KAaeVGfZPp1KOiDLB0jba11tG6OP1u11QnYfb7pXn6IZx0xceqWRr6ygke8+Kw74IpOoSi7/DwANhy8Q==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.5.0.tgz", + "integrity": "sha512-mcSOo9zeUg1L0CoJH7zmxwUG5ggQHU1UrRf8jyTYy6HxdZV+r0PBoL1bxr+JHIPXRzS6u/UW4mEn43y0tmyF8Q==", "requires": { - "@ethersproject/abstract-signer": "^5.4.0", - "@ethersproject/basex": "^5.4.0", - "@ethersproject/bignumber": "^5.4.0", - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/logger": "^5.4.0", - "@ethersproject/pbkdf2": "^5.4.0", - "@ethersproject/properties": "^5.4.0", - "@ethersproject/sha2": "^5.4.0", - "@ethersproject/signing-key": "^5.4.0", - "@ethersproject/strings": "^5.4.0", - "@ethersproject/transactions": "^5.4.0", - "@ethersproject/wordlists": "^5.4.0" + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/basex": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/pbkdf2": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/sha2": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0", + "@ethersproject/strings": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/wordlists": "^5.5.0" + }, + "dependencies": { + "@ethersproject/abstract-provider": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", + "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", + "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "requires": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + } + }, + "@ethersproject/address": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", + "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/rlp": "^5.5.0" + } + }, + "@ethersproject/base64": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", + "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "requires": { + "@ethersproject/bytes": "^5.5.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "requires": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", + "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + }, + "@ethersproject/networks": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/properties": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", + "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/rlp": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", + "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", + "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "bn.js": "^4.11.9", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "@ethersproject/strings": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", + "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/transactions": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", + "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "requires": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0" + } + }, + "@ethersproject/web": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "requires": { + "@ethersproject/base64": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + } } }, "@ethersproject/json-wallets": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.4.0.tgz", - "integrity": "sha512-igWcu3fx4aiczrzEHwG1xJZo9l1cFfQOWzTqwRw/xcvxTk58q4f9M7cjh51EKphMHvrJtcezJ1gf1q1AUOfEQQ==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.5.0.tgz", + "integrity": "sha512-9lA21XQnCdcS72xlBn1jfQdj2A1VUxZzOzi9UkNdnokNKke/9Ya2xA9aIK1SC3PQyBDLt4C+dfps7ULpkvKikQ==", "requires": { - "@ethersproject/abstract-signer": "^5.4.0", - "@ethersproject/address": "^5.4.0", - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/hdnode": "^5.4.0", - "@ethersproject/keccak256": "^5.4.0", - "@ethersproject/logger": "^5.4.0", - "@ethersproject/pbkdf2": "^5.4.0", - "@ethersproject/properties": "^5.4.0", - "@ethersproject/random": "^5.4.0", - "@ethersproject/strings": "^5.4.0", - "@ethersproject/transactions": "^5.4.0", + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/hdnode": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/pbkdf2": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/random": "^5.5.0", + "@ethersproject/strings": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", "aes-js": "3.0.0", "scrypt-js": "3.0.1" + }, + "dependencies": { + "@ethersproject/abstract-provider": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", + "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", + "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "requires": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + } + }, + "@ethersproject/address": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", + "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/rlp": "^5.5.0" + } + }, + "@ethersproject/base64": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", + "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "requires": { + "@ethersproject/bytes": "^5.5.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "requires": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", + "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + }, + "@ethersproject/networks": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/properties": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", + "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/rlp": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", + "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", + "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "bn.js": "^4.11.9", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "@ethersproject/strings": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", + "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/transactions": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", + "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "requires": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0" + } + }, + "@ethersproject/web": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "requires": { + "@ethersproject/base64": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + } } }, "@ethersproject/keccak256": { @@ -812,12 +1374,27 @@ } }, "@ethersproject/pbkdf2": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.4.0.tgz", - "integrity": "sha512-x94aIv6tiA04g6BnazZSLoRXqyusawRyZWlUhKip2jvoLpzJuLb//KtMM6PEovE47pMbW+Qe1uw+68ameJjB7g==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.5.0.tgz", + "integrity": "sha512-SaDvQFvXPnz1QGpzr6/HToLifftSXGoXrbpZ6BvoZhmx4bNLHrxDe8MZisuecyOziP1aVEwzC2Hasj+86TgWVg==", "requires": { - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/sha2": "^5.4.0" + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/sha2": "^5.5.0" + }, + "dependencies": { + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + } } }, "@ethersproject/properties": { @@ -829,31 +1406,213 @@ } }, "@ethersproject/providers": { - "version": "5.4.5", - "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.4.5.tgz", - "integrity": "sha512-1GkrvkiAw3Fj28cwi1Sqm8ED1RtERtpdXmRfwIBGmqBSN5MoeRUHuwHPppMtbPayPgpFcvD7/Gdc9doO5fGYgw==", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.5.2.tgz", + "integrity": "sha512-hkbx7x/MKcRjyrO4StKXCzCpWer6s97xnm34xkfPiarhtEUVAN4TBBpamM+z66WcTt7H5B53YwbRj1n7i8pZoQ==", "requires": { - "@ethersproject/abstract-provider": "^5.4.0", - "@ethersproject/abstract-signer": "^5.4.0", - "@ethersproject/address": "^5.4.0", - "@ethersproject/basex": "^5.4.0", - "@ethersproject/bignumber": "^5.4.0", - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/constants": "^5.4.0", - "@ethersproject/hash": "^5.4.0", - "@ethersproject/logger": "^5.4.0", - "@ethersproject/networks": "^5.4.0", - "@ethersproject/properties": "^5.4.0", - "@ethersproject/random": "^5.4.0", - "@ethersproject/rlp": "^5.4.0", - "@ethersproject/sha2": "^5.4.0", - "@ethersproject/strings": "^5.4.0", - "@ethersproject/transactions": "^5.4.0", - "@ethersproject/web": "^5.4.0", + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/basex": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/hash": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/random": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/sha2": "^5.5.0", + "@ethersproject/strings": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0", "bech32": "1.1.4", "ws": "7.4.6" }, "dependencies": { + "@ethersproject/abstract-provider": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", + "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", + "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "requires": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + } + }, + "@ethersproject/address": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", + "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/rlp": "^5.5.0" + } + }, + "@ethersproject/base64": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", + "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "requires": { + "@ethersproject/bytes": "^5.5.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "requires": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "@ethersproject/hash": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", + "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", + "requires": { + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", + "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + }, + "@ethersproject/networks": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/properties": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", + "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/rlp": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", + "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", + "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "bn.js": "^4.11.9", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "@ethersproject/strings": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", + "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/transactions": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", + "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "requires": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0" + } + }, + "@ethersproject/web": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "requires": { + "@ethersproject/base64": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, "ws": { "version": "7.4.6", "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", @@ -862,12 +1621,27 @@ } }, "@ethersproject/random": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.4.0.tgz", - "integrity": "sha512-pnpWNQlf0VAZDEOVp1rsYQosmv2o0ITS/PecNw+mS2/btF8eYdspkN0vIXrCMtkX09EAh9bdk8GoXmFXM1eAKw==", + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.5.1.tgz", + "integrity": "sha512-YaU2dQ7DuhL5Au7KbcQLHxcRHfgyNgvFV4sQOo0HrtW3Zkrc9ctWNz8wXQ4uCSfSDsqX2vcjhroxU5RQRV0nqA==", "requires": { - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/logger": "^5.4.0" + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + }, + "dependencies": { + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + } } }, "@ethersproject/rlp": { @@ -880,13 +1654,28 @@ } }, "@ethersproject/sha2": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.4.0.tgz", - "integrity": "sha512-siheo36r1WD7Cy+bDdE1BJ8y0bDtqXCOxRMzPa4bV1TGt/eTUUt03BHoJNB6reWJD8A30E/pdJ8WFkq+/uz4Gg==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.5.0.tgz", + "integrity": "sha512-B5UBoglbCiHamRVPLA110J+2uqsifpZaTmid2/7W5rbtYVz6gus6/hSDieIU/6gaKIDcOj12WnOdiymEUHIAOA==", "requires": { - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/logger": "^5.4.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", "hash.js": "1.1.7" + }, + "dependencies": { + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + } } }, "@ethersproject/signing-key": { @@ -903,15 +1692,73 @@ } }, "@ethersproject/solidity": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.4.0.tgz", - "integrity": "sha512-XFQTZ7wFSHOhHcV1DpcWj7VXECEiSrBuv7JErJvB9Uo+KfCdc3QtUZV+Vjh/AAaYgezUEKbCtE6Khjm44seevQ==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.5.0.tgz", + "integrity": "sha512-9NgZs9LhGMj6aCtHXhtmFQ4AN4sth5HuFXVvAQtzmm0jpSCNOTGtrHZJAeYTh7MBjRR8brylWZxBZR9zDStXbw==", "requires": { - "@ethersproject/bignumber": "^5.4.0", - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/keccak256": "^5.4.0", - "@ethersproject/sha2": "^5.4.0", - "@ethersproject/strings": "^5.4.0" + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/sha2": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + }, + "dependencies": { + "@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "requires": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", + "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + }, + "@ethersproject/strings": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", + "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + } } }, "@ethersproject/strings": { @@ -941,35 +1788,252 @@ } }, "@ethersproject/units": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.4.0.tgz", - "integrity": "sha512-Z88krX40KCp+JqPCP5oPv5p750g+uU6gopDYRTBGcDvOASh6qhiEYCRatuM/suC4S2XW9Zz90QI35MfSrTIaFg==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.5.0.tgz", + "integrity": "sha512-7+DpjiZk4v6wrikj+TCyWWa9dXLNU73tSTa7n0TSJDxkYbV3Yf1eRh9ToMLlZtuctNYu9RDNNy2USq3AdqSbag==", "requires": { - "@ethersproject/bignumber": "^5.4.0", - "@ethersproject/constants": "^5.4.0", - "@ethersproject/logger": "^5.4.0" + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + }, + "dependencies": { + "@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "requires": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + } } }, "@ethersproject/wallet": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.4.0.tgz", - "integrity": "sha512-wU29majLjM6AjCjpat21mPPviG+EpK7wY1+jzKD0fg3ui5fgedf2zEu1RDgpfIMsfn8fJHJuzM4zXZ2+hSHaSQ==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.5.0.tgz", + "integrity": "sha512-Mlu13hIctSYaZmUOo7r2PhNSd8eaMPVXe1wxrz4w4FCE4tDYBywDH+bAR1Xz2ADyXGwqYMwstzTrtUVIsKDO0Q==", "requires": { - "@ethersproject/abstract-provider": "^5.4.0", - "@ethersproject/abstract-signer": "^5.4.0", - "@ethersproject/address": "^5.4.0", - "@ethersproject/bignumber": "^5.4.0", - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/hash": "^5.4.0", - "@ethersproject/hdnode": "^5.4.0", - "@ethersproject/json-wallets": "^5.4.0", - "@ethersproject/keccak256": "^5.4.0", - "@ethersproject/logger": "^5.4.0", - "@ethersproject/properties": "^5.4.0", - "@ethersproject/random": "^5.4.0", - "@ethersproject/signing-key": "^5.4.0", - "@ethersproject/transactions": "^5.4.0", - "@ethersproject/wordlists": "^5.4.0" + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/hash": "^5.5.0", + "@ethersproject/hdnode": "^5.5.0", + "@ethersproject/json-wallets": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/random": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/wordlists": "^5.5.0" + }, + "dependencies": { + "@ethersproject/abstract-provider": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", + "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", + "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "requires": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + } + }, + "@ethersproject/address": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", + "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/rlp": "^5.5.0" + } + }, + "@ethersproject/base64": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", + "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "requires": { + "@ethersproject/bytes": "^5.5.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "requires": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "@ethersproject/hash": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", + "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", + "requires": { + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", + "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + }, + "@ethersproject/networks": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/properties": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", + "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/rlp": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", + "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", + "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "bn.js": "^4.11.9", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "@ethersproject/strings": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", + "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/transactions": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", + "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "requires": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0" + } + }, + "@ethersproject/web": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "requires": { + "@ethersproject/base64": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + } } }, "@ethersproject/web": { @@ -985,15 +2049,199 @@ } }, "@ethersproject/wordlists": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.4.0.tgz", - "integrity": "sha512-FemEkf6a+EBKEPxlzeVgUaVSodU7G0Na89jqKjmWMlDB0tomoU8RlEMgUvXyqtrg8N4cwpLh8nyRnm1Nay1isA==", + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.5.0.tgz", + "integrity": "sha512-bL0UTReWDiaQJJYOC9sh/XcRu/9i2jMrzf8VLRmPKx58ckSlOJiohODkECCO50dtLZHcGU6MLXQ4OOrgBwP77Q==", "requires": { - "@ethersproject/bytes": "^5.4.0", - "@ethersproject/hash": "^5.4.0", - "@ethersproject/logger": "^5.4.0", - "@ethersproject/properties": "^5.4.0", - "@ethersproject/strings": "^5.4.0" + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/hash": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + }, + "dependencies": { + "@ethersproject/abstract-provider": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", + "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", + "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "requires": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + } + }, + "@ethersproject/address": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", + "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/rlp": "^5.5.0" + } + }, + "@ethersproject/base64": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", + "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "requires": { + "@ethersproject/bytes": "^5.5.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "requires": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "@ethersproject/hash": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", + "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", + "requires": { + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", + "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + }, + "@ethersproject/networks": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/properties": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", + "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/rlp": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", + "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", + "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "bn.js": "^4.11.9", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "@ethersproject/strings": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", + "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/transactions": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", + "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "requires": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0" + } + }, + "@ethersproject/web": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "requires": { + "@ethersproject/base64": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + } } }, "@nodelib/fs.scandir": { @@ -1023,9 +2271,9 @@ } }, "@nomiclabs/hardhat-ethers": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.2.tgz", - "integrity": "sha512-6quxWe8wwS4X5v3Au8q1jOvXYEPkS1Fh+cME5u6AwNdnI4uERvPlVjlgRWzpnb+Rrt1l/cEqiNRH9GlsBMSDQg==", + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@nomiclabs/hardhat-ethers/-/hardhat-ethers-2.0.4.tgz", + "integrity": "sha512-7LMR344TkdCYkMVF9LuC9VU2NBIi84akQiwqm7OufpWaDgHbWhuanY53rk3SVAW0E4HBk5xn5wl5+bN5f+Mq5w==", "dev": true }, "@nomiclabs/hardhat-etherscan": { @@ -4520,40 +5768,240 @@ } }, "ethers": { - "version": "5.4.7", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.4.7.tgz", - "integrity": "sha512-iZc5p2nqfWK1sj8RabwsPM28cr37Bpq7ehTQ5rWExBr2Y09Sn1lDKZOED26n+TsZMye7Y6mIgQ/1cwpSD8XZew==", + "version": "5.5.3", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.5.3.tgz", + "integrity": "sha512-fTT4WT8/hTe/BLwRUtl7I5zlpF3XC3P/Xwqxc5AIP2HGlH15qpmjs0Ou78az93b1rLITzXLFxoNX63B8ZbUd7g==", "requires": { - "@ethersproject/abi": "5.4.1", - "@ethersproject/abstract-provider": "5.4.1", - "@ethersproject/abstract-signer": "5.4.1", - "@ethersproject/address": "5.4.0", - "@ethersproject/base64": "5.4.0", - "@ethersproject/basex": "5.4.0", - "@ethersproject/bignumber": "5.4.2", - "@ethersproject/bytes": "5.4.0", - "@ethersproject/constants": "5.4.0", - "@ethersproject/contracts": "5.4.1", - "@ethersproject/hash": "5.4.0", - "@ethersproject/hdnode": "5.4.0", - "@ethersproject/json-wallets": "5.4.0", - "@ethersproject/keccak256": "5.4.0", - "@ethersproject/logger": "5.4.1", - "@ethersproject/networks": "5.4.2", - "@ethersproject/pbkdf2": "5.4.0", - "@ethersproject/properties": "5.4.1", - "@ethersproject/providers": "5.4.5", - "@ethersproject/random": "5.4.0", - "@ethersproject/rlp": "5.4.0", - "@ethersproject/sha2": "5.4.0", - "@ethersproject/signing-key": "5.4.0", - "@ethersproject/solidity": "5.4.0", - "@ethersproject/strings": "5.4.0", - "@ethersproject/transactions": "5.4.0", - "@ethersproject/units": "5.4.0", - "@ethersproject/wallet": "5.4.0", - "@ethersproject/web": "5.4.0", - "@ethersproject/wordlists": "5.4.0" + "@ethersproject/abi": "5.5.0", + "@ethersproject/abstract-provider": "5.5.1", + "@ethersproject/abstract-signer": "5.5.0", + "@ethersproject/address": "5.5.0", + "@ethersproject/base64": "5.5.0", + "@ethersproject/basex": "5.5.0", + "@ethersproject/bignumber": "5.5.0", + "@ethersproject/bytes": "5.5.0", + "@ethersproject/constants": "5.5.0", + "@ethersproject/contracts": "5.5.0", + "@ethersproject/hash": "5.5.0", + "@ethersproject/hdnode": "5.5.0", + "@ethersproject/json-wallets": "5.5.0", + "@ethersproject/keccak256": "5.5.0", + "@ethersproject/logger": "5.5.0", + "@ethersproject/networks": "5.5.2", + "@ethersproject/pbkdf2": "5.5.0", + "@ethersproject/properties": "5.5.0", + "@ethersproject/providers": "5.5.2", + "@ethersproject/random": "5.5.1", + "@ethersproject/rlp": "5.5.0", + "@ethersproject/sha2": "5.5.0", + "@ethersproject/signing-key": "5.5.0", + "@ethersproject/solidity": "5.5.0", + "@ethersproject/strings": "5.5.0", + "@ethersproject/transactions": "5.5.0", + "@ethersproject/units": "5.5.0", + "@ethersproject/wallet": "5.5.0", + "@ethersproject/web": "5.5.1", + "@ethersproject/wordlists": "5.5.0" + }, + "dependencies": { + "@ethersproject/abi": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.5.0.tgz", + "integrity": "sha512-loW7I4AohP5KycATvc0MgujU6JyCHPqHdeoo9z3Nr9xEiNioxa65ccdm1+fsoJhkuhdRtfcL8cfyGamz2AxZ5w==", + "requires": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/hash": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "@ethersproject/abstract-provider": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.5.1.tgz", + "integrity": "sha512-m+MA/ful6eKbxpr99xUYeRvLkfnlqzrF8SZ46d/xFB1A7ZVknYc/sXJG0RcufF52Qn2jeFj1hhcoQ7IXjNKUqg==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/networks": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/transactions": "^5.5.0", + "@ethersproject/web": "^5.5.0" + } + }, + "@ethersproject/abstract-signer": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.5.0.tgz", + "integrity": "sha512-lj//7r250MXVLKI7sVarXAbZXbv9P50lgmJQGr2/is82EwEb8r7HrxsmMqAjTsztMYy7ohrIhGMIml+Gx4D3mA==", + "requires": { + "@ethersproject/abstract-provider": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0" + } + }, + "@ethersproject/address": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.5.0.tgz", + "integrity": "sha512-l4Nj0eWlTUh6ro5IbPTgbpT4wRbdH5l8CQf7icF7sb/SI3Nhd9Y9HzhonTSTi6CefI0necIw7LJqQPopPLZyWw==", + "requires": { + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/rlp": "^5.5.0" + } + }, + "@ethersproject/base64": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.5.0.tgz", + "integrity": "sha512-tdayUKhU1ljrlHzEWbStXazDpsx4eg1dBXUSI6+mHlYklOXoXF6lZvw8tnD6oVaWfnMxAgRSKROg3cVKtCcppA==", + "requires": { + "@ethersproject/bytes": "^5.5.0" + } + }, + "@ethersproject/bignumber": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.5.0.tgz", + "integrity": "sha512-6Xytlwvy6Rn3U3gKEc1vP7nR92frHkv6wtVr95LFR3jREXiCPzdWxKQ1cx4JGQBXxcguAwjA8murlYN2TSiEbg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "bn.js": "^4.11.9" + } + }, + "@ethersproject/bytes": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.5.0.tgz", + "integrity": "sha512-ABvc7BHWhZU9PNM/tANm/Qx4ostPGadAuQzWTr3doklZOhDlmcBqclrQe/ZXUIj3K8wC28oYeuRa+A37tX9kog==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/constants": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.5.0.tgz", + "integrity": "sha512-2MsRRVChkvMWR+GyMGY4N1sAX9Mt3J9KykCsgUFd/1mwS0UH1qw+Bv9k1UJb3X3YJYFco9H20pjSlOIfCG5HYQ==", + "requires": { + "@ethersproject/bignumber": "^5.5.0" + } + }, + "@ethersproject/hash": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.5.0.tgz", + "integrity": "sha512-dnGVpK1WtBjmnp3mUT0PlU2MpapnwWI0PibldQEq1408tQBAbZpPidkWoVVuNMOl/lISO3+4hXZWCL3YV7qzfg==", + "requires": { + "@ethersproject/abstract-signer": "^5.5.0", + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "@ethersproject/keccak256": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.5.0.tgz", + "integrity": "sha512-5VoFCTjo2rYbBe1l2f4mccaRFN/4VQEYFwwn04aJV2h7qf4ZvI2wFxUE1XOX+snbwCLRzIeikOqtAoPwMza9kg==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "js-sha3": "0.8.0" + } + }, + "@ethersproject/logger": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.5.0.tgz", + "integrity": "sha512-rIY/6WPm7T8n3qS2vuHTUBPdXHl+rGxWxW5okDfo9J4Z0+gRRZT0msvUdIJkE4/HS29GUMziwGaaKO2bWONBrg==" + }, + "@ethersproject/networks": { + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.5.2.tgz", + "integrity": "sha512-NEqPxbGBfy6O3x4ZTISb90SjEDkWYDUbEeIFhJly0F7sZjoQMnj5KYzMSkMkLKZ+1fGpx00EDpHQCy6PrDupkQ==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/properties": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.5.0.tgz", + "integrity": "sha512-l3zRQg3JkD8EL3CPjNK5g7kMx4qSwiR60/uk5IVjd3oq1MZR5qUg40CNOoEJoX5wc3DyY5bt9EbMk86C7x0DNA==", + "requires": { + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/rlp": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.5.0.tgz", + "integrity": "sha512-hLv8XaQ8PTI9g2RHoQGf/WSxBfTB/NudRacbzdxmst5VHAqd1sMibWG7SENzT5Dj3yZ3kJYx+WiRYEcQTAkcYA==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/signing-key": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.5.0.tgz", + "integrity": "sha512-5VmseH7qjtNmDdZBswavhotYbWB0bOwKIlOTSlX14rKn5c11QmJwGt4GHeo7NrL/Ycl7uo9AHvEqs5xZgFBTng==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "bn.js": "^4.11.9", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "@ethersproject/strings": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.5.0.tgz", + "integrity": "sha512-9fy3TtF5LrX/wTrBaT8FGE6TDJyVjOvXynXJz5MT5azq+E6D92zuKNx7i29sWW2FjVOaWjAsiZ1ZWznuduTIIQ==", + "requires": { + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/logger": "^5.5.0" + } + }, + "@ethersproject/transactions": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.5.0.tgz", + "integrity": "sha512-9RZYSKX26KfzEd/1eqvv8pLauCKzDTub0Ko4LfIgaERvRuwyaNV78mJs7cpIgZaDl6RJui4o49lHwwCM0526zA==", + "requires": { + "@ethersproject/address": "^5.5.0", + "@ethersproject/bignumber": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/constants": "^5.5.0", + "@ethersproject/keccak256": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/rlp": "^5.5.0", + "@ethersproject/signing-key": "^5.5.0" + } + }, + "@ethersproject/web": { + "version": "5.5.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.5.1.tgz", + "integrity": "sha512-olvLvc1CB12sREc1ROPSHTdFCdvMh0J5GSJYiQg2D0hdD4QmJDy8QYDb1CvoqD/bF1c++aeKv2sR5uduuG9dQg==", + "requires": { + "@ethersproject/base64": "^5.5.0", + "@ethersproject/bytes": "^5.5.0", + "@ethersproject/logger": "^5.5.0", + "@ethersproject/properties": "^5.5.0", + "@ethersproject/strings": "^5.5.0" + } + }, + "js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + } } }, "ethjs-abi": { @@ -4966,6 +6414,23 @@ "reusify": "^1.0.4" } }, + "file-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/file-match/-/file-match-1.0.2.tgz", + "integrity": "sha1-ycrSZdLIrfOoFHWw30dYWQafrvc=", + "requires": { + "utils-extend": "^1.0.6" + } + }, + "file-system": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/file-system/-/file-system-2.2.2.tgz", + "integrity": "sha1-fWWDPjojR9zZVqgTxncVPtPt2Yc=", + "requires": { + "file-match": "^1.0.1", + "utils-extend": "^1.0.4" + } + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -19216,6 +20681,11 @@ "object.getownpropertydescriptors": "^2.1.1" } }, + "utils-extend": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/utils-extend/-/utils-extend-1.0.8.tgz", + "integrity": "sha1-zP17ZFQPjpDuIe7Fd2nQZRyril8=" + }, "utils-merge": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz", diff --git a/contracts/basic-bandwidth-generation/package.json b/contracts/basic-bandwidth-generation/package.json index 14503ac52e..8e1a155817 100644 --- a/contracts/basic-bandwidth-generation/package.json +++ b/contracts/basic-bandwidth-generation/package.json @@ -1,11 +1,11 @@ { "devDependencies": { - "@nomiclabs/hardhat-ethers": "^2.0.2", + "@nomiclabs/hardhat-ethers": "^2.0.4", "@nomiclabs/hardhat-etherscan": "^2.1.6", "@nomiclabs/hardhat-waffle": "^2.0.1", "chai": "^4.3.4", "ethereum-waffle": "^3.4.0", - "ethers": "^5.4.7", + "ethers": "^5.5.3", "hardhat": "^2.6.4", "solidity-coverage": "^0.7.17" }, @@ -15,6 +15,7 @@ "@openzeppelin/contracts": "4.3.1", "@openzeppelin/test-helpers": "^0.5.15", "dotenv": "^10.0.0", + "file-system": "^2.2.2", "find-config": "^1.0.0" } } From 08a2bc5c8d5dbcf4750e20bc97776a4d63526ad1 Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 10 Jan 2022 14:44:14 +0100 Subject: [PATCH 05/73] updated scripts to be network specific --- .../scripts/deploy.js | 30 ------------------- .../rinkeby/deploy-bandwidth-generator.js | 28 +++++++++++++++++ .../scripts/rinkeby/deploy-gravity.js | 30 +++++++++++++++++++ 3 files changed, 58 insertions(+), 30 deletions(-) delete mode 100644 contracts/basic-bandwidth-generation/scripts/deploy.js create mode 100644 contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-bandwidth-generator.js create mode 100644 contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js diff --git a/contracts/basic-bandwidth-generation/scripts/deploy.js b/contracts/basic-bandwidth-generation/scripts/deploy.js deleted file mode 100644 index aa0943d76e..0000000000 --- a/contracts/basic-bandwidth-generation/scripts/deploy.js +++ /dev/null @@ -1,30 +0,0 @@ -const { ethers } = require('hardhat'); -const contracts = require('../contractAddresses.json'); - -async function main() { - const [deployer] = await ethers.getSigners(); - - console.log("Deploying contracts with the account:", deployer.address); - - // console.log("Account balance:", (await deployer.getBalance()).toString()); - const balance = await provider.getBalance(deployer.address); - console.log(balance) - - // const BurnableToken = await ethers.getContractFactory("BurnableToken"); - // const burnToken = await BurnableToken.deploy("BURNTOKEN","B4A"); - // console.log(`token deployed at ${burnToken.address}`); - - // const BurnForAccess = await ethers.getContractFactory("BurnForAccess"); - // const burn4access = await BurnForAccess.deploy(burnToken.address); - // const burn4access = await BurnForAccess.deploy(contracts.Rinkeby.BurnableToken); - - // console.log(`Burn4Access contract deployed at ${burn4access.address}`); - // TODO automatically update contractAddresses.json -} - -main() - .then(() => process.exit(0)) - .catch((error) => { - console.error(error); - process.exit(1); - }); diff --git a/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-bandwidth-generator.js b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-bandwidth-generator.js new file mode 100644 index 0000000000..dfce8f78f8 --- /dev/null +++ b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-bandwidth-generator.js @@ -0,0 +1,28 @@ +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"); + // 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.BANDWIDTH_GENERATOR = 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); + }); diff --git a/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js new file mode 100644 index 0000000000..0a4f468c17 --- /dev/null +++ b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js @@ -0,0 +1,30 @@ +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(); + const Gravity = await ethers.getContractFactory("Gravity"); + // deploy with args from unit tests + const gravity = await Gravity.deploy( + constants.ZERO_BYTES32, + [deployer.address], + [2863311531] + ); + + contracts.rinkeby.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); + }); From e6d2626fd77a5d4d4b67986d5be135af219a8387 Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 10 Jan 2022 15:14:24 +0100 Subject: [PATCH 06/73] deployed gravity to rinkeby --- .../basic-bandwidth-generation/contractAddresses.json | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/contracts/basic-bandwidth-generation/contractAddresses.json b/contracts/basic-bandwidth-generation/contractAddresses.json index 07d071452f..c13fbccdd8 100644 --- a/contracts/basic-bandwidth-generation/contractAddresses.json +++ b/contracts/basic-bandwidth-generation/contractAddresses.json @@ -1,8 +1 @@ -{ - "Rinkeby": - { - "NYM_ERC20":"", - "BANDWIDTH_GENERATOR":"", - "GRAVITY":"" - } -} +{"rinkeby":{"NYM_ERC20":"","BANDWIDTH_GENERATOR":"","GRAVITY":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B"}} \ No newline at end of file From f7853c5531e3143826b2574447ed2496df06fd8d Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 10 Jan 2022 15:14:49 +0100 Subject: [PATCH 07/73] added args library for etherscan verification --- .../scripts/rinkeby/gravity-args.js | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 contracts/basic-bandwidth-generation/scripts/rinkeby/gravity-args.js diff --git a/contracts/basic-bandwidth-generation/scripts/rinkeby/gravity-args.js b/contracts/basic-bandwidth-generation/scripts/rinkeby/gravity-args.js new file mode 100644 index 0000000000..4fcb240804 --- /dev/null +++ b/contracts/basic-bandwidth-generation/scripts/rinkeby/gravity-args.js @@ -0,0 +1,6 @@ +// arguments for verification of gravity contract via hardhat-etherscan plugin +module.exports = [ + "0x0000000000000000000000000000000000000000000000000000000000000000", + ["0xf5b1B5C9b89906219Ba29a6cb12F0528c4C25D18"], + [2863311531] +]; \ No newline at end of file From bb959544af3faba4a2a62fc4f7494f964699129e Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 10 Jan 2022 15:18:44 +0100 Subject: [PATCH 08/73] extra logging for verification --- .../scripts/rinkeby/deploy-gravity.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js index 0a4f468c17..44b269bbeb 100644 --- a/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js +++ b/contracts/basic-bandwidth-generation/scripts/rinkeby/deploy-gravity.js @@ -5,6 +5,8 @@ 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("Gravity"); // deploy with args from unit tests const gravity = await Gravity.deploy( From 55775b6e7b18e2df232aca78e093134787befbd6 Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Mon, 10 Jan 2022 16:05:45 +0100 Subject: [PATCH 09/73] added args for verifying token deployed by gravity bridge --- .../scripts/rinkeby/test-token-args.js | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 contracts/basic-bandwidth-generation/scripts/rinkeby/test-token-args.js diff --git a/contracts/basic-bandwidth-generation/scripts/rinkeby/test-token-args.js b/contracts/basic-bandwidth-generation/scripts/rinkeby/test-token-args.js new file mode 100644 index 0000000000..31b58bd7e3 --- /dev/null +++ b/contracts/basic-bandwidth-generation/scripts/rinkeby/test-token-args.js @@ -0,0 +1,7 @@ +// arguments for verification of gravity contract via hardhat-etherscan plugin +module.exports = [ + "0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B", + "test", + "tst", + 6 +]; \ No newline at end of file From 904caca9de3e1bdd2d3079e88d363fb01c7ba14b Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Tue, 11 Jan 2022 13:43:46 +0100 Subject: [PATCH 10/73] added mainnet deploy script + prettified contract addresses json --- .../contractAddresses.json | 13 ++++++++- .../mainnet/deploy-bandwidth-generator.js | 28 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 contracts/basic-bandwidth-generation/scripts/mainnet/deploy-bandwidth-generator.js diff --git a/contracts/basic-bandwidth-generation/contractAddresses.json b/contracts/basic-bandwidth-generation/contractAddresses.json index c13fbccdd8..a63d95b5c7 100644 --- a/contracts/basic-bandwidth-generation/contractAddresses.json +++ b/contracts/basic-bandwidth-generation/contractAddresses.json @@ -1 +1,12 @@ -{"rinkeby":{"NYM_ERC20":"","BANDWIDTH_GENERATOR":"","GRAVITY":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B"}} \ No newline at end of file +{ + "rinkeby": { + "NYM_ERC20":"", + "BANDWIDTH_GENERATOR":"", + "GRAVITY":"0xe58c12f8bA4a28e87841b10BdEdf80A47F86BA9B" + }, + "mainnet": { + "NYM_ERC20":"", + "BANDWIDTH_GENERATOR":"", + "GRAVITY":"" + } +} \ No newline at end of file diff --git a/contracts/basic-bandwidth-generation/scripts/mainnet/deploy-bandwidth-generator.js b/contracts/basic-bandwidth-generation/scripts/mainnet/deploy-bandwidth-generator.js new file mode 100644 index 0000000000..638eb3b920 --- /dev/null +++ b/contracts/basic-bandwidth-generation/scripts/mainnet/deploy-bandwidth-generator.js @@ -0,0 +1,28 @@ +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"); + // 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.NYM_ERC20, + contracts.mainnet.GRAVITY + ); + + contracts.mainnet.BANDWIDTH_GENERATOR = 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); + }); From d785d621ec47bbf1aaff696ab18e1bd6b31625bb Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Tue, 11 Jan 2022 14:36:03 +0100 Subject: [PATCH 11/73] temporarily removed indexd string (in place of just string now) from emitted event in bandwidth generator --- .../contracts/token/ERC20/ERC20.sol/ERC20.dbg.json | 2 +- .../contracts/token/ERC20/IERC20.sol/IERC20.dbg.json | 2 +- .../extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json | 2 +- .../contracts/utils/Context.sol/Context.dbg.json | 2 +- .../cache/solidity-files-cache.json | 6 +++--- .../contracts/BandwidthGenerator.sol | 2 +- .../basic-bandwidth-generation/test/BandwidthGenerator.js | 8 ++++---- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json index aa8cbd790e..11b9533d70 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/ERC20.sol/ERC20.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/e1b958725c1d5919797e36f0f70bc832.json" + "buildInfo": "../../../../../build-info/c0a67c83b3155a7293390fdd5cae3164.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json index aa8cbd790e..11b9533d70 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/IERC20.sol/IERC20.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../build-info/e1b958725c1d5919797e36f0f70bc832.json" + "buildInfo": "../../../../../build-info/c0a67c83b3155a7293390fdd5cae3164.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json index 7b717081d4..51e028920f 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol/IERC20Metadata.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../../../build-info/e1b958725c1d5919797e36f0f70bc832.json" + "buildInfo": "../../../../../../build-info/c0a67c83b3155a7293390fdd5cae3164.json" } diff --git a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json index 2dd3eaa178..df363bc5b1 100644 --- a/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json +++ b/contracts/basic-bandwidth-generation/artifacts/@openzeppelin/contracts/utils/Context.sol/Context.dbg.json @@ -1,4 +1,4 @@ { "_format": "hh-sol-dbg-1", - "buildInfo": "../../../../build-info/e1b958725c1d5919797e36f0f70bc832.json" + "buildInfo": "../../../../build-info/c0a67c83b3155a7293390fdd5cae3164.json" } diff --git a/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json b/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json index 7367e1811f..6d058fc5c9 100644 --- a/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json +++ b/contracts/basic-bandwidth-generation/cache/solidity-files-cache.json @@ -2,8 +2,8 @@ "_format": "hh-sol-cache-2", "files": { "/home/max/dev/nymtech/nym/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol": { - "lastModificationDate": 1641816859262, - "contentHash": "7637957db2593564c0135f527db4673b", + "lastModificationDate": 1641908013011, + "contentHash": "7de243b3b780dd7ee86ffb17fc6f3e07", "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": 1641811013678, + "lastModificationDate": 1641825755989, "contentHash": "fc5dd09fe73bc6cfece970f702a3aba1", "sourceName": "contracts/CosmosToken.sol", "solcConfig": { diff --git a/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol b/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol index 1a5aa7ff22..215c4e5205 100644 --- a/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol +++ b/contracts/basic-bandwidth-generation/contracts/BandwidthGenerator.sol @@ -28,7 +28,7 @@ contract BandwidthGenerator is Ownable { uint256 Bandwidth, uint256 indexed VerificationKey, bytes SignedVerificationKey, - string indexed CosmosRecipient + string CosmosRecipient ); event RatioChanged( diff --git a/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js b/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js index c2ccf287f7..ba338ca4da 100644 --- a/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js +++ b/contracts/basic-bandwidth-generation/test/BandwidthGenerator.js @@ -13,7 +13,7 @@ contract('BandwidthGenerator', (accounts) => { let erc20token; let owner = accounts[0]; let user = accounts[1]; - let cosmosRecipient = 'nymt1f06hzmwf9chqewkpv93ajk6tayzp4784m2da9x'; // random sandbox testnet address + 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 @@ -106,7 +106,7 @@ contract('BandwidthGenerator', (accounts) => { Bandwidth: expectedBandwidthInMB.toString(), VerificationKey: '15', SignedVerificationKey: '0x39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba', - // CosmosRecipient: cosmosRecipient + CosmosRecipient: cosmosRecipient }); await expectEvent.inTransaction(tx.tx, erc20token, 'Transfer', { @@ -144,7 +144,7 @@ contract('BandwidthGenerator', (accounts) => { Bandwidth: newexpectedBandwidthInMB.toString(), VerificationKey: '15', SignedVerificationKey: '0x39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba', - // CosmosRecipient: cosmosRecipient + CosmosRecipient: cosmosRecipient }); await expectEvent.inTransaction(tx.tx, erc20token, 'Transfer', { @@ -207,7 +207,7 @@ contract('BandwidthGenerator', (accounts) => { Bandwidth: expectedBandwidthInMB.toString(), VerificationKey: '15', SignedVerificationKey: '0x39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba39530a00eae2a5aac8144209ccac917ae56bf4a9589544cb0020f92fee35a3ba', - // CosmosRecipient: cosmosRecipient + CosmosRecipient: cosmosRecipient }); await expectEvent.inTransaction(tx.tx, erc20token, 'Transfer', { From 17a30be842dee19e7d8cf0997851d087c258ca1d Mon Sep 17 00:00:00 2001 From: mfahampshire Date: Tue, 11 Jan 2022 14:42:33 +0100 Subject: [PATCH 12/73] added mainnet gravity contract address --- contracts/basic-bandwidth-generation/contractAddresses.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contracts/basic-bandwidth-generation/contractAddresses.json b/contracts/basic-bandwidth-generation/contractAddresses.json index a63d95b5c7..7d25dfda13 100644 --- a/contracts/basic-bandwidth-generation/contractAddresses.json +++ b/contracts/basic-bandwidth-generation/contractAddresses.json @@ -7,6 +7,6 @@ "mainnet": { "NYM_ERC20":"", "BANDWIDTH_GENERATOR":"", - "GRAVITY":"" + "GRAVITY":"0xa4108aA1Ec4967F8b52220a4f7e94A8201F2D906" } } \ No newline at end of file From c61f89144e4742c6156e94093161500155e5b0b4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jan 2022 14:00:06 +0000 Subject: [PATCH 13/73] Bump follow-redirects from 1.14.5 to 1.14.7 in /testnet-faucet (#1040) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.5 to 1.14.7. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.5...v1.14.7) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- testnet-faucet/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/testnet-faucet/yarn.lock b/testnet-faucet/yarn.lock index 15a51c7dc6..8e8a21efd3 100644 --- a/testnet-faucet/yarn.lock +++ b/testnet-faucet/yarn.lock @@ -2674,9 +2674,9 @@ find-root@^1.1.0: integrity sha512-NKfW6bec6GfKc0SGx1e07QZY9PE99u0Bft/0rzSD5k3sO/vwkVUpDUKVm5Gpp5Ue3YfShPFTX2070tDs5kB9Ng== follow-redirects@^1.0.0, follow-redirects@^1.14.0: - version "1.14.5" - resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.5.tgz#f09a5848981d3c772b5392309778523f8d85c381" - integrity sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA== + version "1.14.7" + resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.7.tgz#2004c02eb9436eee9a21446a6477debf17e81685" + integrity sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ== foreach@^2.0.5: version "2.0.5" From 135f1a6e7f32a322177100b1cedc7f1cc38316c1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jan 2022 14:00:12 +0000 Subject: [PATCH 14/73] Bump follow-redirects in /contracts/basic-bandwidth-generation (#1041) Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.14.4 to 1.14.7. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](https://github.com/follow-redirects/follow-redirects/compare/v1.14.4...v1.14.7) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- contracts/basic-bandwidth-generation/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/basic-bandwidth-generation/package-lock.json b/contracts/basic-bandwidth-generation/package-lock.json index eba9f64f04..9b62362542 100644 --- a/contracts/basic-bandwidth-generation/package-lock.json +++ b/contracts/basic-bandwidth-generation/package-lock.json @@ -5059,9 +5059,9 @@ } }, "follow-redirects": { - "version": "1.14.4", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.4.tgz", - "integrity": "sha512-zwGkiSXC1MUJG/qmeIFH2HBJx9u0V46QGUe3YR1fXG8bXQxq7fLj0RjLZQ5nubr9qNJUZrH+xUcwXEoXNpfS+g==", + "version": "1.14.7", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz", + "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==", "dev": true }, "for-each": { From 5b6c1c032ccb11acab66f7eff63ac5e6e6ec7762 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 19 Jan 2022 14:00:19 +0000 Subject: [PATCH 15/73] Bump shelljs in /contracts/basic-bandwidth-generation (#1043) Bumps [shelljs](https://github.com/shelljs/shelljs) from 0.8.4 to 0.8.5. - [Release notes](https://github.com/shelljs/shelljs/releases) - [Changelog](https://github.com/shelljs/shelljs/blob/master/CHANGELOG.md) - [Commits](https://github.com/shelljs/shelljs/compare/v0.8.4...v0.8.5) --- updated-dependencies: - dependency-name: shelljs dependency-type: indirect ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- contracts/basic-bandwidth-generation/package-lock.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/basic-bandwidth-generation/package-lock.json b/contracts/basic-bandwidth-generation/package-lock.json index 9b62362542..4276fd8631 100644 --- a/contracts/basic-bandwidth-generation/package-lock.json +++ b/contracts/basic-bandwidth-generation/package-lock.json @@ -17880,9 +17880,9 @@ "integrity": "sha1-2kL0l0DAtC2yypcoVxyxkMmO/qM=" }, "shelljs": { - "version": "0.8.4", - "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.4.tgz", - "integrity": "sha512-7gk3UZ9kOfPLIAbslLzyWeGiEqx9e3rxwZM0KE6EL8GlGwjym9Mrlx5/p33bWTu9YG6vcS4MBxYZDHYr5lr8BQ==", + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", "dev": true, "requires": { "glob": "^7.0.0", From 93e962524a4ac09675596b575521091742053ac4 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Wed, 19 Jan 2022 14:05:43 +0000 Subject: [PATCH 16/73] update types --- clients/validator/src/types.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/clients/validator/src/types.ts b/clients/validator/src/types.ts index 9b8dc11b2c..786b72ff6c 100644 --- a/clients/validator/src/types.ts +++ b/clients/validator/src/types.ts @@ -135,6 +135,7 @@ export type MixNode = { sphinx_key: string; identity_key: string; version: string; + profit_margin_percent: number; }; export type GatewayBond = { From ecdbe034fa76d8a7fd1a465c86a403f7fab4edb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Stuczy=C5=84ski?= Date: Wed, 19 Jan 2022 19:32:48 +0000 Subject: [PATCH 17/73] Implemented beta clippy lint recommendations (#1051) --- common/client-libs/validator-client/src/client.rs | 1 + common/client-libs/validator-client/src/nymd/wallet/mod.rs | 1 + common/client-libs/validator-client/src/validator_api/mod.rs | 2 +- common/mixnode-common/src/verloc/mod.rs | 1 + common/nymsphinx/src/preparer/mod.rs | 1 + common/nymsphinx/src/receiver.rs | 1 + common/topology/src/filter.rs | 1 + common/topology/src/lib.rs | 2 ++ 8 files changed, 9 insertions(+), 1 deletion(-) diff --git a/common/client-libs/validator-client/src/client.rs b/common/client-libs/validator-client/src/client.rs index 4a3653fb21..2caf379fe6 100644 --- a/common/client-libs/validator-client/src/client.rs +++ b/common/client-libs/validator-client/src/client.rs @@ -25,6 +25,7 @@ use validator_api_requests::models::{ }; #[cfg(feature = "nymd-client")] +#[must_use] pub struct Config { api_url: Url, nymd_url: Url, diff --git a/common/client-libs/validator-client/src/nymd/wallet/mod.rs b/common/client-libs/validator-client/src/nymd/wallet/mod.rs index 195ebc9239..8abbccb7a0 100644 --- a/common/client-libs/validator-client/src/nymd/wallet/mod.rs +++ b/common/client-libs/validator-client/src/nymd/wallet/mod.rs @@ -133,6 +133,7 @@ impl DirectSecp256k1HdWallet { } } +#[must_use] pub struct DirectSecp256k1HdWalletBuilder { /// The password to use when deriving a BIP39 seed from a mnemonic. bip39_password: String, diff --git a/common/client-libs/validator-client/src/validator_api/mod.rs b/common/client-libs/validator-client/src/validator_api/mod.rs index 528f3b9939..c30a76b174 100644 --- a/common/client-libs/validator-client/src/validator_api/mod.rs +++ b/common/client-libs/validator-client/src/validator_api/mod.rs @@ -112,7 +112,7 @@ impl Client { routes::MIXNODES, routes::REWARDED, routes::INCLUSION_CHANCE, - &mixnode_id.to_string(), + mixnode_id, ], NO_PARAMS, ) diff --git a/common/mixnode-common/src/verloc/mod.rs b/common/mixnode-common/src/verloc/mod.rs index 52060cb804..623bdc9e18 100644 --- a/common/mixnode-common/src/verloc/mod.rs +++ b/common/mixnode-common/src/verloc/mod.rs @@ -77,6 +77,7 @@ impl Config { } } +#[must_use] pub struct ConfigBuilder(Config); impl ConfigBuilder { diff --git a/common/nymsphinx/src/preparer/mod.rs b/common/nymsphinx/src/preparer/mod.rs index 63d2f67559..3f56f9bada 100644 --- a/common/nymsphinx/src/preparer/mod.rs +++ b/common/nymsphinx/src/preparer/mod.rs @@ -54,6 +54,7 @@ impl From for PreparationError { /// an optional reply-SURB, padding it to appropriate length, encrypting its content, /// and chunking into appropriate size [`Fragment`]s. #[cfg_attr(not(target_arch = "wasm32"), derive(Clone))] +#[must_use] pub struct MessagePreparer { /// Instance of a cryptographically secure random number generator. rng: R, diff --git a/common/nymsphinx/src/receiver.rs b/common/nymsphinx/src/receiver.rs index d06afa9a91..1707983ca3 100644 --- a/common/nymsphinx/src/receiver.rs +++ b/common/nymsphinx/src/receiver.rs @@ -58,6 +58,7 @@ impl MessageReceiver { } /// Allows setting non-default number of expected mix hops in the network. + #[must_use] pub fn with_mix_hops(mut self, hops: u8) -> Self { self.num_mix_hops = hops; self diff --git a/common/topology/src/filter.rs b/common/topology/src/filter.rs index 652b5f92e9..6c1a3c2fe1 100644 --- a/common/topology/src/filter.rs +++ b/common/topology/src/filter.rs @@ -9,6 +9,7 @@ pub trait Versioned: Clone { } pub trait VersionFilterable { + #[must_use] fn filter_by_version(&self, expected_version: &str) -> Self; } diff --git a/common/topology/src/lib.rs b/common/topology/src/lib.rs index c14256512a..7d5b9843d4 100644 --- a/common/topology/src/lib.rs +++ b/common/topology/src/lib.rs @@ -206,10 +206,12 @@ impl NymTopology { true } + #[must_use] pub fn filter_system_version(&self, expected_version: &str) -> Self { self.filter_node_versions(expected_version, expected_version) } + #[must_use] pub fn filter_node_versions( &self, expected_mix_version: &str, From 8b166f12f8eeb1e2ed1044eda6b0da691b6eb00f Mon Sep 17 00:00:00 2001 From: durch Date: Thu, 20 Jan 2022 11:17:33 +0100 Subject: [PATCH 18/73] Instrument tokio console --- Cargo.lock | 262 ++++++++++++++++++++++++++++++++++++-- validator-api/Cargo.toml | 3 + validator-api/src/main.rs | 5 + 3 files changed, 258 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f8213321ad..c67a8649c3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -771,6 +771,41 @@ dependencies = [ "url", ] +[[package]] +name = "console-api" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14f67643a7d716307ad10b3e3aef02826382acbe349a3e7605ac57556148bc87" +dependencies = [ + "prost", + "prost-types", + "tonic", + "tonic-build", + "tracing-core", +] + +[[package]] +name = "console-subscriber" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "829835c211a0247cd11e65e13cec8696b879374879c35ce162ce8098b23c90d4" +dependencies = [ + "console-api", + "crossbeam-channel", + "futures", + "hdrhistogram", + "humantime 2.1.0", + "serde", + "serde_json", + "thread_local", + "tokio", + "tokio-stream", + "tonic", + "tracing", + "tracing-core", + "tracing-subscriber", +] + [[package]] name = "console_error_panic_hook" version = "0.1.6" @@ -1941,6 +1976,12 @@ dependencies = [ "static_assertions", ] +[[package]] +name = "fixedbitset" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "279fb028e20b3c4c320317955b77c5e0c9701f05a1d309905d6fc702cdc5053e" + [[package]] name = "flate2" version = "1.0.22" @@ -2596,9 +2637,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.4" +version = "0.3.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7f3675cfef6a30c8031cf9e6493ebdc3bb3272a3fea3923c4210d1830e6a472" +checksum = "0c9de88456263e249e241fcd211d3954e2c9b0ef7ccfc235a444eb367cae3689" dependencies = [ "bytes", "fnv", @@ -2651,6 +2692,19 @@ dependencies = [ "hashbrown", ] +[[package]] +name = "hdrhistogram" +version = "7.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6490be71f07a5f62b564bc58e36953f675833df11c7e4a0647bee7a07ca1ec5e" +dependencies = [ + "base64", + "byteorder", + "flate2", + "nom", + "num-traits", +] + [[package]] name = "headers" version = "0.3.4" @@ -2753,9 +2807,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.3" +version = "0.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "399c583b2979440c60be0821a6199eca73bc3c8dcd9d070d75ac726e2c6186e5" +checksum = "1ff4f84919677303da5f147645dbea6b1881f368d03ac84e1dc09031ebd7b2c6" dependencies = [ "bytes", "http", @@ -2807,9 +2861,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.13" +version = "0.14.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15d1cfb9e4f68655fa04c01f59edb405b6074a0f7118ea881e5026e4a1cd8593" +checksum = "b7ec3e62bdc98a2f0393a5048e4c30ef659440ea6e0e572965103e72bd836f55" dependencies = [ "bytes", "futures-channel", @@ -2865,6 +2919,18 @@ dependencies = [ "webpki-roots", ] +[[package]] +name = "hyper-timeout" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbb958482e8c7be4bc3cf272a766a2b0bf1a6755e7a6ae777f017a31d11b13b1" +dependencies = [ + "hyper", + "pin-project-lite", + "tokio", + "tokio-io-timeout", +] + [[package]] name = "hyper-tls" version = "0.5.0" @@ -3481,6 +3547,12 @@ dependencies = [ "version_check", ] +[[package]] +name = "multimap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" + [[package]] name = "native-tls" version = "0.2.8" @@ -3880,9 +3952,11 @@ version = "0.12.0" dependencies = [ "anyhow", "attohttpc 0.18.0", + "cfg-if 1.0.0", "clap", "coconut-interface", "config", + "console-subscriber", "credentials", "crypto", "dirs", @@ -4393,6 +4467,16 @@ dependencies = [ "sha-1 0.8.2", ] +[[package]] +name = "petgraph" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f" +dependencies = [ + "fixedbitset", + "indexmap", +] + [[package]] name = "phf" version = "0.8.0" @@ -4735,6 +4819,26 @@ dependencies = [ "prost-derive", ] +[[package]] +name = "prost-build" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62941722fb675d463659e49c4f3fe1fe792ff24fe5bbaa9c08cd3b98a1c354f5" +dependencies = [ + "bytes", + "heck", + "itertools", + "lazy_static", + "log", + "multimap", + "petgraph", + "prost", + "prost-types", + "regex", + "tempfile", + "which", +] + [[package]] name = "prost-derive" version = "0.9.0" @@ -5851,6 +5955,15 @@ dependencies = [ "opaque-debug 0.3.0", ] +[[package]] +name = "sharded-slab" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "900fba806f70c630b0a382d0d825e17a0f19fcd059a2ade1ff237bcddf446b31" +dependencies = [ + "lazy_static", +] + [[package]] name = "signal-hook-registry" version = "1.4.0" @@ -6995,11 +7108,10 @@ dependencies = [ [[package]] name = "tokio" -version = "1.12.0" +version = "1.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2c2416fdedca8443ae44b4527de1ea633af61d8f7169ffa6e72c5b53d24efcc" +checksum = "fbbf1c778ec206785635ce8ad57fe52b3009ae9e0c9f574a728f3049d3e55838" dependencies = [ - "autocfg 1.0.1", "bytes", "libc", "memchr", @@ -7010,14 +7122,25 @@ dependencies = [ "pin-project-lite", "signal-hook-registry", "tokio-macros", + "tracing", "winapi", ] [[package]] -name = "tokio-macros" -version = "1.3.0" +name = "tokio-io-timeout" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54473be61f4ebe4efd09cec9bd5d16fa51d70ea0192213d754d2d500457db110" +checksum = "30b74022ada614a1b4834de765f9bb43877f910cc8ce4be40e89042c9223a8bf" +dependencies = [ + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-macros" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b557f72f448c511a979e2564e55d74e6c4432fc96ff4f6241bc6bded342643b7" dependencies = [ "proc-macro2", "quote", @@ -7107,6 +7230,49 @@ dependencies = [ "serde", ] +[[package]] +name = "tonic" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a" +dependencies = [ + "async-stream", + "async-trait", + "base64", + "bytes", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "hyper", + "hyper-timeout", + "percent-encoding", + "pin-project", + "prost", + "prost-derive", + "tokio", + "tokio-stream", + "tokio-util", + "tower", + "tower-layer", + "tower-service", + "tracing", + "tracing-futures", +] + +[[package]] +name = "tonic-build" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9403f1bafde247186684b230dc6f38b5cd514584e8bec1dd32514be4745fa757" +dependencies = [ + "proc-macro2", + "prost-build", + "quote", + "syn", +] + [[package]] name = "topology" version = "0.1.0" @@ -7121,6 +7287,33 @@ dependencies = [ "version-checker", ] +[[package]] +name = "tower" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5651b5f6860a99bd1adb59dbfe1db8beb433e73709d9032b413a77e2fb7c066a" +dependencies = [ + "futures-core", + "futures-util", + "indexmap", + "pin-project", + "pin-project-lite", + "rand 0.8.4", + "slab", + "tokio", + "tokio-stream", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "343bc9466d3fe6b0f960ef45960509f84480bf4fd96f92901afe7ff3df9d3a62" + [[package]] name = "tower-service" version = "0.3.1" @@ -7134,10 +7327,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84f96e095c0c82419687c20ddf5cb3eadb61f4e1405923c9dc8e53a1adacbda8" dependencies = [ "cfg-if 1.0.0", + "log", "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4f480b8f81512e825f337ad51e94c1eb5d3bbdf2b363dcd01e2b19a9ffe3f8e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "tracing-core" version = "0.1.20" @@ -7147,6 +7353,27 @@ dependencies = [ "lazy_static", ] +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "pin-project", + "tracing", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77be66445c4eeebb934a7340f227bfe7b338173d3f8c00a60a5a58005c9faecf" +dependencies = [ + "sharded-slab", + "thread_local", + "tracing-core", +] + [[package]] name = "try-lock" version = "0.2.3" @@ -7765,6 +7992,17 @@ dependencies = [ "winapi", ] +[[package]] +name = "which" +version = "4.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea187a8ef279bc014ec368c27a920da2024d2a711109bfbe3440585d5cf27ad9" +dependencies = [ + "either", + "lazy_static", + "libc", +] + [[package]] name = "whoami" version = "1.1.4" diff --git a/validator-api/Cargo.toml b/validator-api/Cargo.toml index 4b0b9bf318..77224e1816 100644 --- a/validator-api/Cargo.toml +++ b/validator-api/Cargo.toml @@ -55,6 +55,9 @@ validator-client = { path="../common/client-libs/validator-client", features = [ version-checker = { path="../common/version-checker" } coconut-interface = { path = "../common/coconut-interface", optional = true } credentials = { path = "../common/credentials", optional = true } +# validator-api needs to be built with RUSTFLAGS="--cfg tokio_unstable" +console-subscriber = { version = "0.1.1", optional = true} +cfg-if = "1.0" [features] coconut = ["coconut-interface", "credentials", "gateway-client/coconut"] diff --git a/validator-api/src/main.rs b/validator-api/src/main.rs index a32995ea2c..698cbc970c 100644 --- a/validator-api/src/main.rs +++ b/validator-api/src/main.rs @@ -570,6 +570,11 @@ async fn run_validator_api(matches: ArgMatches<'static>) -> Result<()> { async fn main() -> Result<()> { println!("Starting validator api..."); + cfg_if::cfg_if! {if #[cfg(feature = "console-subscriber")] { + // instriment tokio console subscriber needs RUSTFLAGS="--cfg tokio_unstable" at build time + console_subscriber::init(); + }} + setup_logging(); let args = parse_args(); run_validator_api(args).await From 6ff02bc2a1e581976450bfd09cd4ff48a360ce38 Mon Sep 17 00:00:00 2001 From: durch Date: Thu, 20 Jan 2022 11:31:35 +0100 Subject: [PATCH 19/73] Fix wallet clippy lints --- nym-wallet/src-tauri/src/network.rs | 2 ++ nym-wallet/src-tauri/src/operations/mixnet/account.rs | 5 ++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/nym-wallet/src-tauri/src/network.rs b/nym-wallet/src-tauri/src/network.rs index ff05ea86e2..3c04f70253 100644 --- a/nym-wallet/src-tauri/src/network.rs +++ b/nym-wallet/src-tauri/src/network.rs @@ -8,6 +8,7 @@ use strum::EnumIter; use crate::error::BackendError; use config::defaults::all::Network as ConfigNetwork; +#[allow(clippy::upper_case_acronyms)] #[cfg_attr(test, derive(ts_rs::TS))] #[derive(Copy, Clone, Debug, Deserialize, EnumIter, Eq, Hash, PartialEq, Serialize)] pub enum Network { @@ -21,6 +22,7 @@ impl Default for Network { } } +#[allow(clippy::from_over_into)] impl Into for Network { fn into(self) -> ConfigNetwork { match self { diff --git a/nym-wallet/src-tauri/src/operations/mixnet/account.rs b/nym-wallet/src-tauri/src/operations/mixnet/account.rs index 1fbfa653c6..eac5a21677 100644 --- a/nym-wallet/src-tauri/src/operations/mixnet/account.rs +++ b/nym-wallet/src-tauri/src/operations/mixnet/account.rs @@ -142,7 +142,6 @@ async fn _connect_with_mnemonic( w_state.add_client(network, client); } - default_account.ok_or(BackendError::NetworkNotSupported( - config::defaults::default_network(), - )) + default_account + .ok_or_else(|| BackendError::NetworkNotSupported(config::defaults::default_network())) } From e52fe65985611171b39a53b567612a4faafabccd Mon Sep 17 00:00:00 2001 From: Mark Sinclair Date: Fri, 21 Jan 2022 11:28:59 +0000 Subject: [PATCH 20/73] Network Explorer: updates to API and UI to show the active set (#1056) * Add identicons package * Tidy up styling and move methods into component directories with better naming * Add mixnode status colours to theme * Mixnode status and icon components * Add status to mixnode types * Add API method to get mixnode details * Add mixnode details to state * Add status and name+description section to mixnode detail page * Wrap with div instead of p * Limit width of description and link to new tab * Limit length of link button and truncate with elipsis * Replace `filter` with `find` * Move mix node detail components to a location that is better named * Refactor mixnode detail state and separate into an independent context from main state. This prevents the mixnode detail page from showing stale data when switching between mix nodes. * Tidy up mixnode detail page adding new state provider and a guard component to handle loading, error and not found states * Layout changes to mixnode description header section * Add methods to Explorer API client to get a mixnode by id, active set by status and overview summary * Add color prop to StatsCard and make count optional * Add optional start and end children to TableToolbar * Tidy up naming * Add summary overview and getting mixnodes by active set status to main state * Add mix node status overview cards * Add mix node status to routes * Mixnode list has a dropdown component to select the active set status * Clean up caching code * Add resource to get a single mixnode by id * Add API resources to get `active`, `inactive` and `standby` mixnodes * Add mixnode summary to API * Add overview summary endpoint to API * Fix OpenAPI/swagger base url * Make clippy happy * Add method to get validators * Add methods to get active and rewarded mixnodes * Fix naming * Move client creation to crate root * Move cache to module * Delete unused files * Add validators API resource * Add gateways API resource * Move tasks to crate root * Add new HTTP resources for validators and gateways to routes * Tidy up naming and locations for mixnodes * Add validator and gateways to state, and tidy up naming * Add gateways and validator modules to main * Overview shows validator and gateway summaries from state * Bundle variable weight Open Sans fonts * Fix up font weights and sizes * Fix up typing * Fix up social icons * Fix navbar colour * Fix paper colour in dark mode and border radius * Fix up stats card * Tidy up Nym icons * Fix up overview * Fix up spacing and padding for overview * Add light mode shades that are darker for mixnode status values * Review feedback --- .../validator-client/src/client.rs | 12 + .../validator-client/src/nymd/mod.rs | 14 + .../src/{mix_node/cache.rs => cache/mod.rs} | 22 +- explorer-api/src/client.rs | 19 + .../country_nodes_distribution.rs | 8 +- .../src/country_statistics/distribution.rs | 2 +- .../src/country_statistics/geolocate.rs | 8 +- explorer-api/src/gateways/http.rs | 24 ++ explorer-api/src/gateways/mod.rs | 2 + explorer-api/src/gateways/models.rs | 55 +++ explorer-api/src/http/mod.rs | 41 +- explorer-api/src/main.rs | 10 +- explorer-api/src/mix_node/http.rs | 43 +- explorer-api/src/mix_node/mod.rs | 1 - explorer-api/src/mix_node/models.rs | 4 +- explorer-api/src/mix_nodes/delegations.rs | 4 +- explorer-api/src/mix_nodes/http.rs | 77 +++- explorer-api/src/mix_nodes/mod.rs | 5 +- explorer-api/src/mix_nodes/models.rs | 91 +++-- explorer-api/src/mix_nodes/tasks.rs | 95 ----- explorer-api/src/mix_nodes/utils.rs | 19 - explorer-api/src/node_numbers/http.rs | 0 .../src/node_numbers/network_size_recorder.rs | 0 explorer-api/src/overview/http.rs | 23 ++ explorer-api/src/overview/mod.rs | 5 + explorer-api/src/overview/models.rs | 15 + explorer-api/src/ping/http.rs | 6 +- explorer-api/src/state.rs | 40 +- explorer-api/src/tasks.rs | 146 +++++++ explorer-api/src/validators/http.rs | 24 ++ explorer-api/src/validators/mod.rs | 2 + explorer-api/src/validators/models.rs | 79 ++++ explorer/package-lock.json | 16 + explorer/package.json | 1 + explorer/src/api/constants.ts | 5 +- explorer/src/api/index.ts | 67 +++- explorer/src/components/BondBreakdown.tsx | 222 ----------- explorer/src/components/ContentCard.tsx | 2 +- .../src/components/CustomColumnHeading.tsx | 2 +- explorer/src/components/DetailTable.tsx | 5 +- explorer/src/components/Gateways.tsx | 26 ++ explorer/src/components/Icons.tsx | 29 ++ .../src/components/MixNodes/BondBreakdown.tsx | 194 +++++++++ .../src/components/MixNodes/DetailSection.tsx | 106 +++++ explorer/src/components/MixNodes/Status.tsx | 53 +++ .../components/MixNodes/StatusDropdown.tsx | 96 +++++ explorer/src/components/MixNodes/index.ts | 44 +++ explorer/src/components/MobileNav.tsx | 2 +- explorer/src/components/Nav.tsx | 11 +- explorer/src/components/Socials.tsx | 44 ++- explorer/src/components/StatsCard.tsx | 69 ++-- explorer/src/components/Switch.tsx | 6 +- explorer/src/components/TableToolbar.tsx | 71 ++-- explorer/src/components/Title.tsx | 1 + explorer/src/context/hooks.ts | 30 ++ explorer/src/context/main.tsx | 192 ++------- explorer/src/context/mixnode.tsx | 174 +++++++++ ...OpenSans-Italic-VariableFont_wdth,wght.ttf | Bin 0 -> 580468 bytes .../fonts/OpenSans-VariableFont_wdth,wght.ttf | Bin 0 -> 529672 bytes explorer/src/icons/GatewaysSVG.tsx | 4 +- explorer/src/icons/MixnodesSVG.tsx | 4 +- explorer/src/icons/ValidatorsSVG.tsx | 4 +- explorer/src/icons/socials/DiscordIcon.tsx | 43 ++ explorer/src/icons/socials/GitHubIcon.tsx | 37 ++ explorer/src/icons/socials/TelegramIcon.tsx | 28 ++ explorer/src/icons/socials/TwitterIcon.tsx | 35 ++ explorer/src/index.html | 5 +- explorer/src/pages/404/index.tsx | 2 +- explorer/src/pages/Gateways/index.tsx | 2 +- explorer/src/pages/MixnodeDetail/index.tsx | 367 ++++++++++-------- explorer/src/pages/Mixnodes/index.tsx | 87 ++++- explorer/src/pages/Overview/index.tsx | 105 +++-- explorer/src/routes/network-components.tsx | 5 +- explorer/src/styles.css | 9 +- explorer/src/theme/mui-theme.d.ts | 13 + explorer/src/theme/theme.ts | 42 +- explorer/src/typeDefs/explorer-api.ts | 40 ++ explorer/src/typings/react-identicons.d.ts | 20 + explorer/src/utils/index.ts | 62 +-- explorer/webpack.common.js | 7 +- 80 files changed, 2302 insertions(+), 983 deletions(-) rename explorer-api/src/{mix_node/cache.rs => cache/mod.rs} (65%) create mode 100644 explorer-api/src/client.rs create mode 100644 explorer-api/src/gateways/http.rs create mode 100644 explorer-api/src/gateways/mod.rs create mode 100644 explorer-api/src/gateways/models.rs delete mode 100644 explorer-api/src/mix_nodes/tasks.rs delete mode 100644 explorer-api/src/node_numbers/http.rs delete mode 100644 explorer-api/src/node_numbers/network_size_recorder.rs create mode 100644 explorer-api/src/overview/http.rs create mode 100644 explorer-api/src/overview/mod.rs create mode 100644 explorer-api/src/overview/models.rs create mode 100644 explorer-api/src/tasks.rs create mode 100644 explorer-api/src/validators/http.rs create mode 100644 explorer-api/src/validators/mod.rs create mode 100644 explorer-api/src/validators/models.rs delete mode 100644 explorer/src/components/BondBreakdown.tsx create mode 100644 explorer/src/components/Gateways.tsx create mode 100644 explorer/src/components/Icons.tsx create mode 100644 explorer/src/components/MixNodes/BondBreakdown.tsx create mode 100644 explorer/src/components/MixNodes/DetailSection.tsx create mode 100644 explorer/src/components/MixNodes/Status.tsx create mode 100644 explorer/src/components/MixNodes/StatusDropdown.tsx create mode 100644 explorer/src/components/MixNodes/index.ts create mode 100644 explorer/src/context/hooks.ts create mode 100644 explorer/src/context/mixnode.tsx create mode 100644 explorer/src/fonts/OpenSans-Italic-VariableFont_wdth,wght.ttf create mode 100644 explorer/src/fonts/OpenSans-VariableFont_wdth,wght.ttf create mode 100644 explorer/src/icons/socials/DiscordIcon.tsx create mode 100644 explorer/src/icons/socials/GitHubIcon.tsx create mode 100644 explorer/src/icons/socials/TelegramIcon.tsx create mode 100644 explorer/src/icons/socials/TwitterIcon.tsx create mode 100644 explorer/src/typings/react-identicons.d.ts diff --git a/common/client-libs/validator-client/src/client.rs b/common/client-libs/validator-client/src/client.rs index 2caf379fe6..cca670cfc5 100644 --- a/common/client-libs/validator-client/src/client.rs +++ b/common/client-libs/validator-client/src/client.rs @@ -184,6 +184,18 @@ impl Client { Ok(self.validator_api.get_mixnodes().await?) } + pub async fn get_cached_rewarded_mixnodes( + &self, + ) -> Result, ValidatorClientError> { + Ok(self.validator_api.get_rewarded_mixnodes().await?) + } + + pub async fn get_cached_active_mixnodes( + &self, + ) -> Result, ValidatorClientError> { + Ok(self.validator_api.get_active_mixnodes().await?) + } + pub async fn get_cached_gateways(&self) -> Result, ValidatorClientError> { Ok(self.validator_api.get_gateways().await?) } diff --git a/common/client-libs/validator-client/src/nymd/mod.rs b/common/client-libs/validator-client/src/nymd/mod.rs index dfaa1abbb8..95d699573d 100644 --- a/common/client-libs/validator-client/src/nymd/mod.rs +++ b/common/client-libs/validator-client/src/nymd/mod.rs @@ -27,9 +27,12 @@ pub use crate::nymd::cosmwasm_client::client::CosmWasmClient; pub use crate::nymd::cosmwasm_client::signing_client::SigningCosmWasmClient; pub use crate::nymd::fee::Fee; use crate::nymd::fee::DEFAULT_SIMULATED_GAS_MULTIPLIER; +pub use cosmrs::rpc::endpoint::validators::Response as ValidatorResponse; pub use cosmrs::rpc::HttpClient as QueryNymdClient; +pub use cosmrs::rpc::Paging; pub use cosmrs::tendermint::block::Height; pub use cosmrs::tendermint::hash; +pub use cosmrs::tendermint::validator::Info as TendermintValidatorInfo; pub use cosmrs::tendermint::Time as TendermintTime; pub use cosmrs::tx::{self, Gas}; pub use cosmrs::Coin as CosmosCoin; @@ -234,6 +237,17 @@ impl NymdClient { .map(|block| block.block_id.hash) } + pub async fn get_validators( + &self, + height: u64, + paging: Paging, + ) -> Result + where + C: CosmWasmClient + Sync, + { + Ok(self.client.validators(height as u32, paging).await?) + } + pub async fn get_balance( &self, address: &AccountId, diff --git a/explorer-api/src/mix_node/cache.rs b/explorer-api/src/cache/mod.rs similarity index 65% rename from explorer-api/src/mix_node/cache.rs rename to explorer-api/src/cache/mod.rs index 6b66ae2e2f..b00b25a1f2 100644 --- a/explorer-api/src/mix_node/cache.rs +++ b/explorer-api/src/cache/mod.rs @@ -13,19 +13,27 @@ impl Cache { } } - pub(crate) fn get(&self, identity_key: &str) -> Option - where - T: Clone, - { + pub(crate) fn len(&self) -> usize { + self.inner.len() + } + + pub(crate) fn get_all(&self) -> Vec { self.inner - .get(identity_key) + .values() + .map(|cache_item| cache_item.value.clone()) + .collect() + } + + pub(crate) fn get(&self, key: &str) -> Option { + self.inner + .get(key) .filter(|cache_item| cache_item.valid_until > SystemTime::now()) .map(|cache_item| cache_item.value.clone()) } - pub(crate) fn set(&mut self, identity_key: &str, value: T) { + pub(crate) fn set(&mut self, key: &str, value: T) { self.inner.insert( - identity_key.to_string(), + key.to_string(), CacheItem { valid_until: SystemTime::now() + Duration::from_secs(60 * 30), value, diff --git a/explorer-api/src/client.rs b/explorer-api/src/client.rs new file mode 100644 index 0000000000..110067572c --- /dev/null +++ b/explorer-api/src/client.rs @@ -0,0 +1,19 @@ +use network_defaults::{ + default_api_endpoints, default_nymd_endpoints, DEFAULT_MIXNET_CONTRACT_ADDRESS, +}; +use validator_client::nymd::QueryNymdClient; + +pub(crate) fn new_nymd_client() -> validator_client::Client { + let mixnet_contract = DEFAULT_MIXNET_CONTRACT_ADDRESS.to_string(); + let nymd_url = default_nymd_endpoints()[0].clone(); + let api_url = default_api_endpoints()[0].clone(); + + let client_config = validator_client::Config::new( + nymd_url, + api_url, + Some(mixnet_contract.parse().unwrap()), + None, + ); + + validator_client::Client::new_query(client_config).expect("Failed to connect to nymd!") +} diff --git a/explorer-api/src/country_statistics/country_nodes_distribution.rs b/explorer-api/src/country_statistics/country_nodes_distribution.rs index 8b5bf85226..f08e1cc330 100644 --- a/explorer-api/src/country_statistics/country_nodes_distribution.rs +++ b/explorer-api/src/country_statistics/country_nodes_distribution.rs @@ -5,13 +5,13 @@ use tokio::sync::RwLock; pub type CountryNodesDistribution = HashMap; #[derive(Clone)] -pub struct ConcurrentCountryNodesDistribution { +pub struct ThreadsafeCountryNodesDistribution { inner: Arc>, } -impl ConcurrentCountryNodesDistribution { +impl ThreadsafeCountryNodesDistribution { pub(crate) fn new() -> Self { - ConcurrentCountryNodesDistribution { + ThreadsafeCountryNodesDistribution { inner: Arc::new(RwLock::new(CountryNodesDistribution::new())), } } @@ -19,7 +19,7 @@ impl ConcurrentCountryNodesDistribution { pub(crate) fn new_from_distribution( country_node_distribution: CountryNodesDistribution, ) -> Self { - ConcurrentCountryNodesDistribution { + ThreadsafeCountryNodesDistribution { inner: Arc::new(RwLock::new(country_node_distribution)), } } diff --git a/explorer-api/src/country_statistics/distribution.rs b/explorer-api/src/country_statistics/distribution.rs index dba66ecab6..ebbc1eca9b 100644 --- a/explorer-api/src/country_statistics/distribution.rs +++ b/explorer-api/src/country_statistics/distribution.rs @@ -30,7 +30,7 @@ impl CountryStatisticsDistributionTask { /// Retrieves the current list of mixnodes from the validators and calculates how many nodes are in each country async fn calculate_nodes_per_country(&mut self) { - let cache = self.state.inner.mix_nodes.get_location_cache().await; + let cache = self.state.inner.mixnodes.get_locations().await; let three_letter_iso_country_codes: Vec = cache .values() diff --git a/explorer-api/src/country_statistics/geolocate.rs b/explorer-api/src/country_statistics/geolocate.rs index 55cd428798..170d4f5cc1 100644 --- a/explorer-api/src/country_statistics/geolocate.rs +++ b/explorer-api/src/country_statistics/geolocate.rs @@ -41,7 +41,7 @@ impl GeoLocateTask { let mixnode_bonds = self .state .inner - .mix_nodes + .mixnodes .get_mixnodes() .await .unwrap_or_default(); @@ -50,7 +50,7 @@ impl GeoLocateTask { if self .state .inner - .mix_nodes + .mixnodes .is_location_valid(&cache_item.mix_node.identity_key) .await { @@ -79,7 +79,7 @@ impl GeoLocateTask { self.state .inner - .mix_nodes + .mixnodes .set_location(&cache_item.mix_node.identity_key, Some(location)) .await; @@ -98,7 +98,7 @@ impl GeoLocateTask { ); self.state .inner - .mix_nodes + .mixnodes .set_location(&cache_item.mix_node.identity_key, None) .await; }, diff --git a/explorer-api/src/gateways/http.rs b/explorer-api/src/gateways/http.rs new file mode 100644 index 0000000000..084507eed5 --- /dev/null +++ b/explorer-api/src/gateways/http.rs @@ -0,0 +1,24 @@ +// Copyright 2022 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use rocket::response::status::NotFound; +use rocket::serde::json::Json; +use rocket::{Route, State}; +use rocket_okapi::okapi::openapi3::OpenApi; +use rocket_okapi::openapi_get_routes_spec; +use rocket_okapi::settings::OpenApiSettings; + +use crate::state::ExplorerApiStateContext; +use mixnet_contract_common::GatewayBond; + +pub fn gateways_make_default_routes(settings: &OpenApiSettings) -> (Vec, OpenApi) { + openapi_get_routes_spec![settings: list] +} + +#[openapi(tag = "gateways")] +#[get("/")] +pub(crate) async fn list( + state: &State, +) -> Result>, NotFound> { + Ok(Json(state.inner.gateways.get_gateways().await)) +} diff --git a/explorer-api/src/gateways/mod.rs b/explorer-api/src/gateways/mod.rs new file mode 100644 index 0000000000..5df938f83c --- /dev/null +++ b/explorer-api/src/gateways/mod.rs @@ -0,0 +1,2 @@ +pub(crate) mod http; +pub(crate) mod models; diff --git a/explorer-api/src/gateways/models.rs b/explorer-api/src/gateways/models.rs new file mode 100644 index 0000000000..690aa7cb7e --- /dev/null +++ b/explorer-api/src/gateways/models.rs @@ -0,0 +1,55 @@ +// Copyright 2022 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use std::sync::Arc; + +use serde::Serialize; +use tokio::sync::RwLock; + +use mixnet_contract_common::GatewayBond; + +use crate::cache::Cache; + +pub(crate) struct GatewayCache { + pub(crate) gateways: Cache, +} + +#[derive(Clone, Debug, Serialize, JsonSchema)] +pub(crate) struct GatewaySummary { + pub count: usize, +} + +#[derive(Clone)] +pub(crate) struct ThreadsafeGatewayCache { + inner: Arc>, +} + +impl ThreadsafeGatewayCache { + pub(crate) fn new() -> Self { + ThreadsafeGatewayCache { + inner: Arc::new(RwLock::new(GatewayCache { + gateways: Cache::new(), + })), + } + } + + pub(crate) async fn get_gateways(&self) -> Vec { + self.inner.read().await.gateways.get_all() + } + + pub(crate) async fn get_gateway_summary(&self) -> GatewaySummary { + GatewaySummary { + count: self.inner.read().await.gateways.len(), + } + } + + pub(crate) async fn update_cache(&self, gateways: Vec) { + let mut guard = self.inner.write().await; + + for gateway in gateways { + guard + .gateways + .set(gateway.clone().gateway.identity_key.as_str(), gateway) + } + } +} diff --git a/explorer-api/src/http/mod.rs b/explorer-api/src/http/mod.rs index 0cb78e6b4e..e75aec8762 100644 --- a/explorer-api/src/http/mod.rs +++ b/explorer-api/src/http/mod.rs @@ -1,15 +1,19 @@ use log::info; +use okapi::openapi3::OpenApi; use rocket::http::Method; use rocket::{Build, Request, Rocket}; use rocket_cors::{AllowedHeaders, AllowedOrigins}; use rocket_okapi::swagger_ui::make_swagger_ui; use crate::country_statistics::http::country_statistics_make_default_routes; +use crate::gateways::http::gateways_make_default_routes; use crate::http::swagger::get_docs; use crate::mix_node::http::mix_node_make_default_routes; use crate::mix_nodes::http::mix_nodes_make_default_routes; +use crate::overview::http::overview_make_default_routes; use crate::ping::http::ping_make_default_routes; use crate::state::ExplorerApiStateContext; +use crate::validators::http::validators_make_default_routes; mod swagger; @@ -38,14 +42,20 @@ fn configure_rocket(state: ExplorerApiStateContext) -> Rocket { let config = rocket::config::Config::release_default(); let mut building_rocket = rocket::build().configure(config); + let custom_route_spec = (vec![], custom_openapi_spec()); + mount_endpoints_and_merged_docs! { building_rocket, "/v1".to_owned(), openapi_settings, - "/ping" => ping_make_default_routes(&openapi_settings), + "/" => custom_route_spec, "/countries" => country_statistics_make_default_routes(&openapi_settings), + "/gateways" => gateways_make_default_routes(&openapi_settings), "/mix-node" => mix_node_make_default_routes(&openapi_settings), "/mix-nodes" => mix_nodes_make_default_routes(&openapi_settings), + "/overview" => overview_make_default_routes(&openapi_settings), + "/ping" => ping_make_default_routes(&openapi_settings), + "/validators" => validators_make_default_routes(&openapi_settings), }; building_rocket @@ -59,3 +69,32 @@ fn configure_rocket(state: ExplorerApiStateContext) -> Rocket { pub(crate) fn not_found(req: &Request) -> String { format!("I couldn't find '{}'. Try something else?", req.uri()) } + +fn custom_openapi_spec() -> OpenApi { + use rocket_okapi::okapi::openapi3::*; + OpenApi { + openapi: OpenApi::default_version(), + info: Info { + title: "Network Explorer API".to_owned(), + description: None, + terms_of_service: None, + contact: None, + license: None, + version: env!("CARGO_PKG_VERSION").to_owned(), + ..Default::default() + }, + servers: get_servers(), + ..Default::default() + } +} + +fn get_servers() -> Vec { + if std::env::var_os("CARGO").is_some() { + return vec![]; + } + return vec![rocket_okapi::okapi::openapi3::Server { + url: std::env::var("OPEN_API_BASE").unwrap_or_else(|_| "/api/v1/".to_owned()), + description: Some("API".to_owned()), + ..Default::default() + }]; +} diff --git a/explorer-api/src/main.rs b/explorer-api/src/main.rs index 999e9f3fc7..8ec90aaf4b 100644 --- a/explorer-api/src/main.rs +++ b/explorer-api/src/main.rs @@ -5,12 +5,18 @@ extern crate rocket_okapi; use log::info; +pub(crate) mod cache; +mod client; mod country_statistics; +mod gateways; mod http; mod mix_node; -mod mix_nodes; +pub(crate) mod mix_nodes; +mod overview; mod ping; mod state; +mod tasks; +mod validators; const GEO_IP_SERVICE: &str = "https://api.freegeoip.app/json"; const COUNTRY_DATA_REFRESH_INTERVAL: u64 = 60 * 15; // every 15 minutes @@ -40,7 +46,7 @@ impl ExplorerApi { info!("Using validator API - {}", validator_api_url); // spawn concurrent tasks - mix_nodes::tasks::MixNodesTasks::new(self.state.clone(), validator_api_url).start(); + crate::tasks::ExplorerApiTasks::new(self.state.clone()).start(); country_statistics::distribution::CountryStatisticsDistributionTask::new( self.state.clone(), ) diff --git a/explorer-api/src/mix_node/http.rs b/explorer-api/src/mix_node/http.rs index c3888f393e..d948327f2a 100644 --- a/explorer-api/src/mix_node/http.rs +++ b/explorer-api/src/mix_node/http.rs @@ -1,26 +1,47 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::mix_node::models::{NodeDescription, NodeStats}; -use crate::mix_nodes::delegations::{get_mixnode_delegations, get_single_mixnode_delegations}; -use crate::state::ExplorerApiStateContext; -use mixnet_contract_common::Delegation; use reqwest::Error as ReqwestError; +use rocket::response::status::NotFound; use rocket::serde::json::Json; use rocket::{Route, State}; use rocket_okapi::okapi::openapi3::OpenApi; use rocket_okapi::openapi_get_routes_spec; use rocket_okapi::settings::OpenApiSettings; +use mixnet_contract_common::Delegation; + +use crate::mix_node::models::{NodeDescription, NodeStats, PrettyDetailedMixNodeBond}; +use crate::mix_nodes::delegations::{get_mixnode_delegations, get_single_mixnode_delegations}; +use crate::state::ExplorerApiStateContext; + pub fn mix_node_make_default_routes(settings: &OpenApiSettings) -> (Vec, OpenApi) { openapi_get_routes_spec![ settings: get_delegations, + get_by_id, get_all_delegations, get_description, get_stats, ] } +#[openapi(tag = "mix_nodes")] +#[get("/")] +pub(crate) async fn get_by_id( + pubkey: &str, + state: &State, +) -> Result, NotFound> { + match state + .inner + .mixnodes + .get_detailed_mixnode_by_id(pubkey) + .await + { + Some(mixnode) => Ok(Json(mixnode)), + None => Err(NotFound("Mixnode not found".to_string())), + } +} + #[openapi(tag = "mix_node")] #[get("//delegations")] pub(crate) async fn get_delegations(pubkey: &str) -> Json> { @@ -39,13 +60,7 @@ pub(crate) async fn get_description( pubkey: &str, state: &State, ) -> Option> { - match state - .inner - .mix_node_cache - .clone() - .get_description(pubkey) - .await - { + match state.inner.mixnode.clone().get_description(pubkey).await { Some(cache_value) => { trace!("Returning cached value for {}", pubkey); Some(Json(cache_value)) @@ -64,7 +79,7 @@ pub(crate) async fn get_description( // cache the response and return as the HTTP response state .inner - .mix_node_cache + .mixnode .set_description(pubkey, response.clone()) .await; Some(Json(response)) @@ -90,7 +105,7 @@ pub(crate) async fn get_stats( pubkey: &str, state: &State, ) -> Option> { - match state.inner.mix_node_cache.get_node_stats(pubkey).await { + match state.inner.mixnode.get_node_stats(pubkey).await { Some(cache_value) => { trace!("Returning cached value for {}", pubkey); Some(Json(cache_value)) @@ -106,7 +121,7 @@ pub(crate) async fn get_stats( // cache the response and return as the HTTP response state .inner - .mix_node_cache + .mixnode .set_node_stats(pubkey, response.clone()) .await; Some(Json(response)) diff --git a/explorer-api/src/mix_node/mod.rs b/explorer-api/src/mix_node/mod.rs index b57132ec2c..5df938f83c 100644 --- a/explorer-api/src/mix_node/mod.rs +++ b/explorer-api/src/mix_node/mod.rs @@ -1,3 +1,2 @@ -mod cache; pub(crate) mod http; pub(crate) mod models; diff --git a/explorer-api/src/mix_node/models.rs b/explorer-api/src/mix_node/models.rs index 835bfe3991..c99f1ac77e 100644 --- a/explorer-api/src/mix_node/models.rs +++ b/explorer-api/src/mix_node/models.rs @@ -1,7 +1,7 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::mix_node::cache::Cache; +use crate::cache::Cache; use crate::mix_nodes::location::Location; use mixnet_contract_common::{Addr, Coin, Layer, MixNode}; use serde::Deserialize; @@ -10,7 +10,7 @@ use std::sync::Arc; use std::time::SystemTime; use tokio::sync::RwLock; -#[derive(Clone, Debug, Serialize, JsonSchema)] +#[derive(Clone, Debug, Serialize, JsonSchema, PartialEq)] #[serde(rename_all = "snake_case")] pub(crate) enum MixnodeStatus { Active, // in both the active set and the rewarded set diff --git a/explorer-api/src/mix_nodes/delegations.rs b/explorer-api/src/mix_nodes/delegations.rs index a6f0ee1c05..00fd75ccab 100644 --- a/explorer-api/src/mix_nodes/delegations.rs +++ b/explorer-api/src/mix_nodes/delegations.rs @@ -4,7 +4,7 @@ use mixnet_contract_common::Delegation; pub(crate) async fn get_single_mixnode_delegations(pubkey: &str) -> Vec { - let client = super::utils::new_nymd_client(); + let client = crate::client::new_nymd_client(); let delegates = match client .get_all_nymd_single_mixnode_delegations(pubkey.to_string()) .await @@ -19,7 +19,7 @@ pub(crate) async fn get_single_mixnode_delegations(pubkey: &str) -> Vec Vec { - let client = super::utils::new_nymd_client(); + let client = crate::client::new_nymd_client(); let delegates = match client.get_all_network_delegations().await { Ok(result) => result, Err(e) => { diff --git a/explorer-api/src/mix_nodes/http.rs b/explorer-api/src/mix_nodes/http.rs index a2b8b0eaba..6e57e568c7 100644 --- a/explorer-api/src/mix_nodes/http.rs +++ b/explorer-api/src/mix_nodes/http.rs @@ -1,4 +1,5 @@ -use crate::mix_node::models::PrettyDetailedMixNodeBond; +use crate::mix_node::models::{MixnodeStatus, PrettyDetailedMixNodeBond}; +use crate::mix_nodes::models::{MixNodeActiveSetSummary, MixNodeSummary}; use crate::state::ExplorerApiStateContext; use rocket::serde::json::Json; use rocket::{Route, State}; @@ -7,7 +8,13 @@ use rocket_okapi::openapi_get_routes_spec; use rocket_okapi::settings::OpenApiSettings; pub fn mix_nodes_make_default_routes(settings: &OpenApiSettings) -> (Vec, OpenApi) { - openapi_get_routes_spec![settings: list] + openapi_get_routes_spec![ + settings: list, + list_active_set, + list_inactive_set, + list_standby_set, + summary + ] } #[openapi(tag = "mix_nodes")] @@ -15,5 +22,69 @@ pub fn mix_nodes_make_default_routes(settings: &OpenApiSettings) -> (Vec, pub(crate) async fn list( state: &State, ) -> Json> { - Json(state.inner.mix_nodes.get_detailed_mixnodes().await) + Json(state.inner.mixnodes.get_detailed_mixnodes().await) +} + +#[openapi(tag = "mix_nodes")] +#[get("/active-set/active")] +pub(crate) async fn list_active_set( + state: &State, +) -> Json> { + Json(get_mixnodes_by_status( + state.inner.mixnodes.get_detailed_mixnodes().await, + MixnodeStatus::Active, + )) +} + +#[openapi(tag = "mix_nodes")] +#[get("/active-set/inactive")] +pub(crate) async fn list_inactive_set( + state: &State, +) -> Json> { + Json(get_mixnodes_by_status( + state.inner.mixnodes.get_detailed_mixnodes().await, + MixnodeStatus::Inactive, + )) +} + +#[openapi(tag = "mix_nodes")] +#[get("/active-set/standby")] +pub(crate) async fn list_standby_set( + state: &State, +) -> Json> { + Json(get_mixnodes_by_status( + state.inner.mixnodes.get_detailed_mixnodes().await, + MixnodeStatus::Standby, + )) +} + +#[openapi(tag = "mix_nodes")] +#[get("/summary")] +pub(crate) async fn summary(state: &State) -> Json { + Json(get_mixnode_summary(state).await) +} + +pub(crate) async fn get_mixnode_summary(state: &State) -> MixNodeSummary { + let mixnodes = state.inner.mixnodes.get_detailed_mixnodes().await; + let active = get_mixnodes_by_status(mixnodes.clone(), MixnodeStatus::Active).len(); + let standby = get_mixnodes_by_status(mixnodes.clone(), MixnodeStatus::Standby).len(); + let inactive = get_mixnodes_by_status(mixnodes.clone(), MixnodeStatus::Inactive).len(); + MixNodeSummary { + count: mixnodes.len(), + activeset: MixNodeActiveSetSummary { + active, + standby, + inactive, + }, + } +} + +fn get_mixnodes_by_status( + all_mixnodes: Vec, + status: MixnodeStatus, +) -> Vec { + all_mixnodes + .into_iter() + .filter(|mixnode| mixnode.status == status) + .collect() } diff --git a/explorer-api/src/mix_nodes/mod.rs b/explorer-api/src/mix_nodes/mod.rs index dacff38e32..cd25a4ca43 100644 --- a/explorer-api/src/mix_nodes/mod.rs +++ b/explorer-api/src/mix_nodes/mod.rs @@ -7,8 +7,7 @@ pub(crate) mod delegations; pub(crate) mod http; pub(crate) mod location; pub(crate) mod models; -pub(crate) mod tasks; pub(crate) mod utils; -pub(crate) const MIXNODES_CACHE_REFRESH_RATE: Duration = Duration::from_secs(30); -pub(crate) const MIXNODES_CACHE_ENTRY_TTL: Duration = Duration::from_secs(60); +pub(crate) const CACHE_REFRESH_RATE: Duration = Duration::from_secs(30); +pub(crate) const CACHE_ENTRY_TTL: Duration = Duration::from_secs(60); diff --git a/explorer-api/src/mix_nodes/models.rs b/explorer-api/src/mix_nodes/models.rs index 7a07131fc1..bd2ebe4fe8 100644 --- a/explorer-api/src/mix_nodes/models.rs +++ b/explorer-api/src/mix_nodes/models.rs @@ -1,15 +1,32 @@ // Copyright 2022 - Nym Technologies SA // SPDX-License-Identifier: Apache-2.0 -use crate::mix_node::models::{MixnodeStatus, PrettyDetailedMixNodeBond}; -use crate::mix_nodes::location::{Location, LocationCache, LocationCacheItem}; -use crate::mix_nodes::MIXNODES_CACHE_ENTRY_TTL; -use mixnet_contract_common::MixNodeBond; use std::collections::{HashMap, HashSet}; use std::sync::Arc; use std::time::{Duration, SystemTime}; + +use serde::Serialize; use tokio::sync::RwLock; +use mixnet_contract_common::MixNodeBond; + +use crate::mix_node::models::{MixnodeStatus, PrettyDetailedMixNodeBond}; +use crate::mix_nodes::location::{Location, LocationCache, LocationCacheItem}; +use crate::mix_nodes::CACHE_ENTRY_TTL; + +#[derive(Clone, Debug, Serialize, JsonSchema)] +pub(crate) struct MixNodeActiveSetSummary { + pub active: usize, + pub standby: usize, + pub inactive: usize, +} + +#[derive(Clone, Debug, Serialize, JsonSchema)] +pub(crate) struct MixNodeSummary { + pub count: usize, + pub activeset: MixNodeActiveSetSummary, +} + #[derive(Clone, Debug)] pub(crate) struct MixNodesResult { pub(crate) valid_until: SystemTime, @@ -60,28 +77,28 @@ impl MixNodesResult { } #[derive(Clone)] -pub(crate) struct ThreadsafeMixNodesResult { - mixnode_results: Arc>, - location_cache: Arc>, +pub(crate) struct ThreadsafeMixNodesCache { + mixnodes: Arc>, + locations: Arc>, } -impl ThreadsafeMixNodesResult { +impl ThreadsafeMixNodesCache { pub(crate) fn new() -> Self { - ThreadsafeMixNodesResult { - mixnode_results: Arc::new(RwLock::new(MixNodesResult::new())), - location_cache: Arc::new(RwLock::new(LocationCache::new())), + ThreadsafeMixNodesCache { + mixnodes: Arc::new(RwLock::new(MixNodesResult::new())), + locations: Arc::new(RwLock::new(LocationCache::new())), } } - pub(crate) fn new_with_location_cache(location_cache: LocationCache) -> Self { - ThreadsafeMixNodesResult { - mixnode_results: Arc::new(RwLock::new(MixNodesResult::new())), - location_cache: Arc::new(RwLock::new(location_cache)), + pub(crate) fn new_with_location_cache(locations: LocationCache) -> Self { + ThreadsafeMixNodesCache { + mixnodes: Arc::new(RwLock::new(MixNodesResult::new())), + locations: Arc::new(RwLock::new(locations)), } } pub(crate) async fn is_location_valid(&self, identity_key: &str) -> bool { - self.location_cache + self.locations .read() .await .get(identity_key) @@ -89,29 +106,53 @@ impl ThreadsafeMixNodesResult { .unwrap_or(false) } - pub(crate) async fn get_location_cache(&self) -> LocationCache { - self.location_cache.read().await.clone() + pub(crate) async fn get_locations(&self) -> LocationCache { + self.locations.read().await.clone() } pub(crate) async fn set_location(&self, identity_key: &str, location: Option) { // cache the location for this mix node so that it can be used when the mix node list is refreshed - self.location_cache.write().await.insert( + self.locations.write().await.insert( identity_key.to_string(), LocationCacheItem::new_from_location(location), ); } pub(crate) async fn get_mixnode(&self, pubkey: &str) -> Option { - self.mixnode_results.read().await.get_mixnode(pubkey) + self.mixnodes.read().await.get_mixnode(pubkey) } pub(crate) async fn get_mixnodes(&self) -> Option> { - self.mixnode_results.read().await.get_mixnodes() + self.mixnodes.read().await.get_mixnodes() + } + + pub(crate) async fn get_detailed_mixnode_by_id( + &self, + identity_key: &str, + ) -> Option { + let mixnodes_guard = self.mixnodes.read().await; + let location_guard = self.locations.read().await; + + let bond = mixnodes_guard.get_mixnode(identity_key); + let location = location_guard.get(identity_key); + + match bond { + Some(bond) => Some(PrettyDetailedMixNodeBond { + location: location.and_then(|l| l.location.clone()), + status: mixnodes_guard.determine_node_status(&bond.mix_node.identity_key), + pledge_amount: bond.pledge_amount, + total_delegation: bond.total_delegation, + owner: bond.owner, + layer: bond.layer, + mix_node: bond.mix_node, + }), + None => None, + } } pub(crate) async fn get_detailed_mixnodes(&self) -> Vec { - let mixnodes_guard = self.mixnode_results.read().await; - let location_guard = self.location_cache.read().await; + let mixnodes_guard = self.mixnodes.read().await; + let location_guard = self.locations.read().await; mixnodes_guard .all_mixnodes @@ -138,13 +179,13 @@ impl ThreadsafeMixNodesResult { rewarded_nodes: HashSet, active_nodes: HashSet, ) { - let mut guard = self.mixnode_results.write().await; + let mut guard = self.mixnodes.write().await; guard.all_mixnodes = all_bonds .into_iter() .map(|bond| (bond.mix_node.identity_key.to_string(), bond)) .collect(); guard.rewarded_mixnodes = rewarded_nodes; guard.active_mixnodes = active_nodes; - guard.valid_until = SystemTime::now() + MIXNODES_CACHE_ENTRY_TTL; + guard.valid_until = SystemTime::now() + CACHE_ENTRY_TTL; } } diff --git a/explorer-api/src/mix_nodes/tasks.rs b/explorer-api/src/mix_nodes/tasks.rs deleted file mode 100644 index b6257c1660..0000000000 --- a/explorer-api/src/mix_nodes/tasks.rs +++ /dev/null @@ -1,95 +0,0 @@ -// Copyright 2022 - Nym Technologies SA -// SPDX-License-Identifier: Apache-2.0 - -use crate::mix_nodes::MIXNODES_CACHE_REFRESH_RATE; -use crate::state::ExplorerApiStateContext; -use mixnet_contract_common::MixNodeBond; -use reqwest::Url; -use std::future::Future; -use validator_client::ValidatorClientError; - -pub(crate) struct MixNodesTasks { - state: ExplorerApiStateContext, - validator_api_client: validator_client::ApiClient, -} - -impl MixNodesTasks { - pub(crate) fn new(state: ExplorerApiStateContext, validator_api_endpoint: Url) -> Self { - MixNodesTasks { - state, - validator_api_client: validator_client::ApiClient::new(validator_api_endpoint), - } - } - - // a helper to remove duplicate code when grabbing active/rewarded/all mixnodes - async fn retrieve_mixnodes<'a, F, Fut>(&'a self, f: F) -> Vec - where - F: FnOnce(&'a validator_client::ApiClient) -> Fut, - Fut: Future, ValidatorClientError>>, - { - let bonds = match f(&self.validator_api_client).await { - Ok(result) => result, - Err(e) => { - error!("Unable to retrieve mixnode bonds: {:?}", e); - vec![] - } - }; - - info!("Fetched {} mixnode bonds", bonds.len()); - bonds - } - - async fn retrieve_all_mixnodes(&self) -> Vec { - info!("About to retrieve all mixnode bonds..."); - self.retrieve_mixnodes(validator_client::ApiClient::get_cached_mixnodes) - .await - } - - async fn retrieve_rewarded_mixnodes(&self) -> Vec { - info!("About to retrieve rewarded mixnode bonds..."); - self.retrieve_mixnodes(validator_client::ApiClient::get_cached_rewarded_mixnodes) - .await - } - - async fn retrieve_active_mixnodes(&self) -> Vec { - info!("About to retrieve active mixnode bonds..."); - self.retrieve_mixnodes(validator_client::ApiClient::get_cached_active_mixnodes) - .await - } - - async fn update_mixnode_cache(&self) { - let all_bonds = self.retrieve_all_mixnodes().await; - let rewarded_nodes = self - .retrieve_rewarded_mixnodes() - .await - .into_iter() - .map(|bond| bond.mix_node.identity_key) - .collect(); - let active_nodes = self - .retrieve_active_mixnodes() - .await - .into_iter() - .map(|bond| bond.mix_node.identity_key) - .collect(); - self.state - .inner - .mix_nodes - .update_cache(all_bonds, rewarded_nodes, active_nodes) - .await; - } - - pub(crate) fn start(self) { - info!("Spawning mix nodes task runner..."); - tokio::spawn(async move { - let mut interval_timer = tokio::time::interval(MIXNODES_CACHE_REFRESH_RATE); - loop { - // wait for the next interval tick - interval_timer.tick().await; - - info!("Updating mix node cache..."); - self.update_mixnode_cache().await; - info!("Done"); - } - }); - } -} diff --git a/explorer-api/src/mix_nodes/utils.rs b/explorer-api/src/mix_nodes/utils.rs index 542bfe8660..a151ec318a 100644 --- a/explorer-api/src/mix_nodes/utils.rs +++ b/explorer-api/src/mix_nodes/utils.rs @@ -3,10 +3,6 @@ use crate::mix_nodes::location::GeoLocation; use isocountry::CountryCode; -use network_defaults::{ - default_api_endpoints, default_nymd_endpoints, DEFAULT_MIXNET_CONTRACT_ADDRESS, -}; -use validator_client::nymd::QueryNymdClient; pub(crate) fn map_2_letter_to_3_letter_country_code(geo: &GeoLocation) -> String { match CountryCode::for_alpha2(&geo.country_code) { @@ -20,18 +16,3 @@ pub(crate) fn map_2_letter_to_3_letter_country_code(geo: &GeoLocation) -> String } } } - -pub(crate) fn new_nymd_client() -> validator_client::Client { - let mixnet_contract = DEFAULT_MIXNET_CONTRACT_ADDRESS.to_string(); - let nymd_url = default_nymd_endpoints()[0].clone(); - let api_url = default_api_endpoints()[0].clone(); - - let client_config = validator_client::Config::new( - nymd_url, - api_url, - Some(mixnet_contract.parse().unwrap()), - None, - ); - - validator_client::Client::new_query(client_config).expect("Failed to connect to nymd!") -} diff --git a/explorer-api/src/node_numbers/http.rs b/explorer-api/src/node_numbers/http.rs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/explorer-api/src/node_numbers/network_size_recorder.rs b/explorer-api/src/node_numbers/network_size_recorder.rs deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/explorer-api/src/overview/http.rs b/explorer-api/src/overview/http.rs new file mode 100644 index 0000000000..a5cfb127c5 --- /dev/null +++ b/explorer-api/src/overview/http.rs @@ -0,0 +1,23 @@ +use rocket::serde::json::Json; +use rocket::{Route, State}; +use rocket_okapi::okapi::openapi3::OpenApi; +use rocket_okapi::openapi_get_routes_spec; +use rocket_okapi::settings::OpenApiSettings; + +use crate::mix_nodes::http::get_mixnode_summary; +use crate::overview::models::OverviewSummary; +use crate::state::ExplorerApiStateContext; + +pub fn overview_make_default_routes(settings: &OpenApiSettings) -> (Vec, OpenApi) { + openapi_get_routes_spec![settings: summary] +} + +#[openapi(tag = "overview")] +#[get("/summary")] +pub(crate) async fn summary(state: &State) -> Json { + Json(OverviewSummary { + mixnodes: get_mixnode_summary(state).await, + validators: state.inner.validators.get_validator_summary().await, + gateways: state.inner.gateways.get_gateway_summary().await, + }) +} diff --git a/explorer-api/src/overview/mod.rs b/explorer-api/src/overview/mod.rs new file mode 100644 index 0000000000..058ccb1d8b --- /dev/null +++ b/explorer-api/src/overview/mod.rs @@ -0,0 +1,5 @@ +// Copyright 2022 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +pub(crate) mod http; +mod models; diff --git a/explorer-api/src/overview/models.rs b/explorer-api/src/overview/models.rs new file mode 100644 index 0000000000..b396e2e3fb --- /dev/null +++ b/explorer-api/src/overview/models.rs @@ -0,0 +1,15 @@ +// Copyright 2022 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use serde::Serialize; + +use crate::gateways::models::GatewaySummary; +use crate::mix_nodes::models::MixNodeSummary; +use crate::validators::models::ValidatorSummary; + +#[derive(Clone, Debug, Serialize, JsonSchema)] +pub(crate) struct OverviewSummary { + pub mixnodes: MixNodeSummary, + pub gateways: GatewaySummary, + pub validators: ValidatorSummary, +} diff --git a/explorer-api/src/ping/http.rs b/explorer-api/src/ping/http.rs index 67a2730bb7..379084436e 100644 --- a/explorer-api/src/ping/http.rs +++ b/explorer-api/src/ping/http.rs @@ -25,7 +25,7 @@ pub(crate) async fn index( pubkey: &str, state: &State, ) -> Option> { - match state.inner.ping_cache.clone().get(pubkey).await { + match state.inner.ping.clone().get(pubkey).await { Some(cache_value) => { trace!("Returning cached value for {}", pubkey); Some(Json(PingResponse { @@ -39,7 +39,7 @@ pub(crate) async fn index( match state.inner.get_mix_node(pubkey).await { Some(bond) => { // set status to pending, so that any HTTP requests are pending - state.inner.ping_cache.set_pending(pubkey).await; + state.inner.ping.set_pending(pubkey).await; // do the check let ports = Some(port_check(&bond).await); @@ -51,7 +51,7 @@ pub(crate) async fn index( // cache for 1 min trace!("Caching value for {}", pubkey); - state.inner.ping_cache.set(pubkey, response.clone()).await; + state.inner.ping.set(pubkey, response.clone()).await; // return response Some(Json(response)) diff --git a/explorer-api/src/state.rs b/explorer-api/src/state.rs index 676c4f9423..b971f76269 100644 --- a/explorer-api/src/state.rs +++ b/explorer-api/src/state.rs @@ -8,27 +8,31 @@ use serde::{Deserialize, Serialize}; use mixnet_contract_common::MixNodeBond; use crate::country_statistics::country_nodes_distribution::{ - ConcurrentCountryNodesDistribution, CountryNodesDistribution, + CountryNodesDistribution, ThreadsafeCountryNodesDistribution, }; +use crate::gateways::models::ThreadsafeGatewayCache; use crate::mix_node::models::ThreadsafeMixNodeCache; use crate::mix_nodes::location::LocationCache; -use crate::mix_nodes::models::ThreadsafeMixNodesResult; +use crate::mix_nodes::models::ThreadsafeMixNodesCache; use crate::ping::models::ThreadsafePingCache; +use crate::validators::models::ThreadsafeValidatorCache; // TODO: change to an environment variable with a default value const STATE_FILE: &str = "explorer-api-state.json"; #[derive(Clone)] pub struct ExplorerApiState { - pub(crate) country_node_distribution: ConcurrentCountryNodesDistribution, - pub(crate) mix_nodes: ThreadsafeMixNodesResult, - pub(crate) mix_node_cache: ThreadsafeMixNodeCache, - pub(crate) ping_cache: ThreadsafePingCache, + pub(crate) country_node_distribution: ThreadsafeCountryNodesDistribution, + pub(crate) gateways: ThreadsafeGatewayCache, + pub(crate) mixnode: ThreadsafeMixNodeCache, + pub(crate) mixnodes: ThreadsafeMixNodesCache, + pub(crate) ping: ThreadsafePingCache, + pub(crate) validators: ThreadsafeValidatorCache, } impl ExplorerApiState { pub(crate) async fn get_mix_node(&self, pubkey: &str) -> Option { - self.mix_nodes.get_mixnode(pubkey).await + self.mixnodes.get_mixnode(pubkey).await } } @@ -61,14 +65,16 @@ impl ExplorerApiStateContext { info!("Loaded state from file {:?}: {:?}", json_file, state); ExplorerApiState { country_node_distribution: - ConcurrentCountryNodesDistribution::new_from_distribution( + ThreadsafeCountryNodesDistribution::new_from_distribution( state.country_node_distribution, ), - mix_nodes: ThreadsafeMixNodesResult::new_with_location_cache( + gateways: ThreadsafeGatewayCache::new(), + mixnode: ThreadsafeMixNodeCache::new(), + mixnodes: ThreadsafeMixNodesCache::new_with_location_cache( state.location_cache, ), - mix_node_cache: ThreadsafeMixNodeCache::new(), - ping_cache: ThreadsafePingCache::new(), + ping: ThreadsafePingCache::new(), + validators: ThreadsafeValidatorCache::new(), } } _ => { @@ -78,10 +84,12 @@ impl ExplorerApiStateContext { ); ExplorerApiState { - country_node_distribution: ConcurrentCountryNodesDistribution::new(), - mix_nodes: ThreadsafeMixNodesResult::new(), - mix_node_cache: ThreadsafeMixNodeCache::new(), - ping_cache: ThreadsafePingCache::new(), + country_node_distribution: ThreadsafeCountryNodesDistribution::new(), + gateways: ThreadsafeGatewayCache::new(), + mixnode: ThreadsafeMixNodeCache::new(), + mixnodes: ThreadsafeMixNodesCache::new(), + ping: ThreadsafePingCache::new(), + validators: ThreadsafeValidatorCache::new(), } } } @@ -93,7 +101,7 @@ impl ExplorerApiStateContext { let file = File::create(json_file_path).expect("unable to create state json file"); let state = ExplorerApiStateOnDisk { country_node_distribution: self.inner.country_node_distribution.get_all().await, - location_cache: self.inner.mix_nodes.get_location_cache().await, + location_cache: self.inner.mixnodes.get_locations().await, as_at: Utc::now(), }; serde_json::to_writer(file, &state).expect("error writing state to disk"); diff --git a/explorer-api/src/tasks.rs b/explorer-api/src/tasks.rs new file mode 100644 index 0000000000..1f09074285 --- /dev/null +++ b/explorer-api/src/tasks.rs @@ -0,0 +1,146 @@ +// Copyright 2022 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use std::future::Future; + +use mixnet_contract_common::{GatewayBond, MixNodeBond}; +use validator_client::nymd::error::NymdError; +use validator_client::nymd::{Paging, QueryNymdClient, ValidatorResponse}; +use validator_client::ValidatorClientError; + +use crate::client::new_nymd_client; +use crate::mix_nodes::CACHE_REFRESH_RATE; +use crate::state::ExplorerApiStateContext; + +pub(crate) struct ExplorerApiTasks { + state: ExplorerApiStateContext, + validator_client: validator_client::Client, +} + +impl ExplorerApiTasks { + pub(crate) fn new(state: ExplorerApiStateContext) -> Self { + ExplorerApiTasks { + state, + validator_client: new_nymd_client(), + } + } + + // a helper to remove duplicate code when grabbing active/rewarded/all mixnodes + async fn retrieve_mixnodes<'a, F, Fut>(&'a self, f: F) -> Vec + where + F: FnOnce(&'a validator_client::Client) -> Fut, + Fut: Future, ValidatorClientError>>, + { + let bonds = match f(&self.validator_client).await { + Ok(result) => result, + Err(e) => { + error!("Unable to retrieve mixnode bonds: {:?}", e); + vec![] + } + }; + + info!("Fetched {} mixnode bonds", bonds.len()); + bonds + } + + async fn retrieve_all_mixnodes(&self) -> Vec { + info!("About to retrieve all mixnode bonds..."); + self.retrieve_mixnodes(validator_client::Client::get_cached_mixnodes) + .await + } + + async fn retrieve_all_gateways(&self) -> Result, ValidatorClientError> { + info!("About to retrieve all gateways..."); + self.validator_client.get_cached_gateways().await + } + + async fn retrieve_all_validators(&self) -> Result { + info!("About to retrieve all validators..."); + let height = self + .validator_client + .nymd + .get_current_block_height() + .await?; + let response: ValidatorResponse = self + .validator_client + .nymd + .get_validators(height.value(), Paging::All) + .await?; + info!("Fetched {} validators", response.validators.len()); + Ok(response) + } + + async fn retrieve_rewarded_mixnodes(&self) -> Vec { + info!("About to retrieve rewarded mixnode bonds..."); + self.retrieve_mixnodes(validator_client::Client::get_cached_rewarded_mixnodes) + .await + } + + async fn retrieve_active_mixnodes(&self) -> Vec { + info!("About to retrieve active mixnode bonds..."); + self.retrieve_mixnodes(validator_client::Client::get_cached_active_mixnodes) + .await + } + + async fn update_mixnode_cache(&self) { + let all_bonds = self.retrieve_all_mixnodes().await; + let rewarded_nodes = self + .retrieve_rewarded_mixnodes() + .await + .into_iter() + .map(|bond| bond.mix_node.identity_key) + .collect(); + let active_nodes = self + .retrieve_active_mixnodes() + .await + .into_iter() + .map(|bond| bond.mix_node.identity_key) + .collect(); + self.state + .inner + .mixnodes + .update_cache(all_bonds, rewarded_nodes, active_nodes) + .await; + } + + async fn update_validators_cache(&self) { + match self.retrieve_all_validators().await { + Ok(response) => self.state.inner.validators.update_cache(response).await, + Err(e) => { + error!("Failed to get validators: {:?}", e) + } + } + } + + async fn update_gateways_cache(&self) { + match self.retrieve_all_gateways().await { + Ok(response) => self.state.inner.gateways.update_cache(response).await, + Err(e) => { + error!("Failed to get gateways: {:?}", e) + } + } + } + + pub(crate) fn start(self) { + info!("Spawning mix nodes task runner..."); + tokio::spawn(async move { + let mut interval_timer = tokio::time::interval(CACHE_REFRESH_RATE); + loop { + // wait for the next interval tick + interval_timer.tick().await; + + info!("Updating validator cache..."); + self.update_validators_cache().await; + info!("Done"); + + info!("Updating gateway cache..."); + self.update_gateways_cache().await; + info!("Done"); + + info!("Updating mix node cache..."); + self.update_mixnode_cache().await; + info!("Done"); + } + }); + } +} diff --git a/explorer-api/src/validators/http.rs b/explorer-api/src/validators/http.rs new file mode 100644 index 0000000000..88a06eea01 --- /dev/null +++ b/explorer-api/src/validators/http.rs @@ -0,0 +1,24 @@ +// Copyright 2022 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use rocket::response::status::NotFound; +use rocket::serde::json::Json; +use rocket::{Route, State}; +use rocket_okapi::okapi::openapi3::OpenApi; +use rocket_okapi::openapi_get_routes_spec; +use rocket_okapi::settings::OpenApiSettings; + +use crate::state::ExplorerApiStateContext; +use crate::validators::models::PrettyValidatorInfo; + +pub fn validators_make_default_routes(settings: &OpenApiSettings) -> (Vec, OpenApi) { + openapi_get_routes_spec![settings: list] +} + +#[openapi(tag = "validators")] +#[get("/")] +pub(crate) async fn list( + state: &State, +) -> Result>, NotFound> { + Ok(Json(state.inner.validators.get_validators().await)) +} diff --git a/explorer-api/src/validators/mod.rs b/explorer-api/src/validators/mod.rs new file mode 100644 index 0000000000..5df938f83c --- /dev/null +++ b/explorer-api/src/validators/mod.rs @@ -0,0 +1,2 @@ +pub(crate) mod http; +pub(crate) mod models; diff --git a/explorer-api/src/validators/models.rs b/explorer-api/src/validators/models.rs new file mode 100644 index 0000000000..4f17cbe14a --- /dev/null +++ b/explorer-api/src/validators/models.rs @@ -0,0 +1,79 @@ +// Copyright 2022 - Nym Technologies SA +// SPDX-License-Identifier: Apache-2.0 + +use std::sync::Arc; + +use serde::Serialize; +use tokio::sync::RwLock; + +use validator_client::nymd::ValidatorResponse; + +use crate::cache::Cache; + +#[derive(Clone, Debug, Serialize, JsonSchema)] +pub(crate) struct PrettyValidatorInfo { + pub address: String, + pub pub_key: String, + pub voting_power: u64, + pub name: Option, +} + +pub(crate) struct ValidatorCache { + pub(crate) validators: Cache, + pub(crate) summary: ValidatorSummary, +} + +#[derive(Clone, Debug, Serialize, JsonSchema)] +pub(crate) struct ValidatorSummary { + pub(crate) count: i32, + pub(crate) block_height: u64, +} + +#[derive(Clone)] +pub(crate) struct ThreadsafeValidatorCache { + inner: Arc>, +} + +impl ThreadsafeValidatorCache { + pub(crate) fn new() -> Self { + ThreadsafeValidatorCache { + inner: Arc::new(RwLock::new(ValidatorCache { + validators: Cache::new(), + summary: ValidatorSummary { + block_height: 0, + count: 0, + }, + })), + } + } + + pub(crate) async fn get_validators(&self) -> Vec { + self.inner.read().await.validators.get_all() + } + + pub(crate) async fn get_validator_summary(&self) -> ValidatorSummary { + self.inner.read().await.summary.clone() + } + + pub(crate) async fn update_cache(&self, validator_response: ValidatorResponse) { + let mut guard = self.inner.write().await; + + for validator in validator_response.validators { + let address = validator.address.to_string(); + guard.validators.set( + address.clone().as_str(), + PrettyValidatorInfo { + address, + pub_key: validator.pub_key.to_hex(), + name: validator.name, + voting_power: validator.power.value(), + }, + ) + } + + guard.summary = ValidatorSummary { + count: validator_response.total, + block_height: validator_response.block_height.value(), + }; + } +} diff --git a/explorer/package-lock.json b/explorer/package-lock.json index b1c9eee465..8dce0ee469 100644 --- a/explorer/package-lock.json +++ b/explorer/package-lock.json @@ -24,6 +24,7 @@ "react": "^17.0.2", "react-dom": "^17.0.2", "react-google-charts": "^3.0.15", + "react-identicons": "^1.2.5", "react-router-dom": "^5.3.0", "react-simple-maps": "^2.3.0", "react-tooltip": "^4.2.21" @@ -13680,6 +13681,15 @@ "react-dom": ">=16.3.0" } }, + "node_modules/react-identicons": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/react-identicons/-/react-identicons-1.2.5.tgz", + "integrity": "sha512-x7prkDoc2pD7wSl2C1pGxS+XAoSdq1ABWJWTBUimVTDVJArKOLd0B4wRUJpDm4r+9y7pgf8ylyPGsmlWSV5n2g==", + "peerDependencies": { + "react": "^17.0.1", + "react-dom": "^17.0.1" + } + }, "node_modules/react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", @@ -27550,6 +27560,12 @@ "react-load-script": "^0.0.6" } }, + "react-identicons": { + "version": "1.2.5", + "resolved": "https://registry.npmjs.org/react-identicons/-/react-identicons-1.2.5.tgz", + "integrity": "sha512-x7prkDoc2pD7wSl2C1pGxS+XAoSdq1ABWJWTBUimVTDVJArKOLd0B4wRUJpDm4r+9y7pgf8ylyPGsmlWSV5n2g==", + "requires": {} + }, "react-is": { "version": "17.0.2", "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", diff --git a/explorer/package.json b/explorer/package.json index 553adb4ecb..039f1ca1a1 100644 --- a/explorer/package.json +++ b/explorer/package.json @@ -19,6 +19,7 @@ "react": "^17.0.2", "react-dom": "^17.0.2", "react-google-charts": "^3.0.15", + "react-identicons": "^1.2.5", "react-router-dom": "^5.3.0", "react-simple-maps": "^2.3.0", "react-tooltip": "^4.2.21" diff --git a/explorer/src/api/constants.ts b/explorer/src/api/constants.ts index 99f749f927..0dc59790da 100644 --- a/explorer/src/api/constants.ts +++ b/explorer/src/api/constants.ts @@ -4,6 +4,7 @@ export const VALIDATOR_API_BASE_URL = process.env.VALIDATOR_API_URL; export const BIG_DIPPER = process.env.BIG_DIPPER_URL; // specific API routes +export const OVERVIEW_API = `${API_BASE_URL}/overview`; export const MIXNODE_PING = `${API_BASE_URL}/ping`; export const MIXNODES_API = `${API_BASE_URL}/mix-nodes`; export const MIXNODE_API = `${API_BASE_URL}/mix-node`; @@ -17,8 +18,4 @@ export const UPTIME_STORY_API = `${VALIDATOR_API_BASE_URL}/api/v1/status/mixnode export const MIXNODE_API_ERROR = "We're having trouble finding that record, please try again or Contact Us."; -// socials -export const TELEGRAM_LINK = 'https://t.me/nymchan'; -export const TWITTER_LINK = 'https://twitter.com/nymproject'; -export const GITHUB_LINK = 'https://github.com/nymtech'; export const NYM_WEBSITE = 'https://nymtech.net'; diff --git a/explorer/src/api/index.ts b/explorer/src/api/index.ts index 808c8bfc5f..43c2b52fa8 100644 --- a/explorer/src/api/index.ts +++ b/explorer/src/api/index.ts @@ -1,24 +1,28 @@ import { - GATEWAYS_API, - MIXNODES_API, - VALIDATORS_API, BLOCK_API, COUNTRY_DATA_API, - MIXNODE_PING, - UPTIME_STORY_API, + GATEWAYS_API, MIXNODE_API, + MIXNODE_PING, + MIXNODES_API, + OVERVIEW_API, + UPTIME_STORY_API, + VALIDATORS_API, } from './constants'; import { - MixNodeResponse, - GatewayResponse, - ValidatorsResponse, CountryDataResponse, - MixNodeResponseItem, DelegationsResponse, + GatewayResponse, + MixNodeDescriptionResponse, + MixNodeResponse, + MixNodeResponseItem, + MixnodeStatus, StatsResponse, StatusResponse, + SummaryOverviewResponse, UptimeStoryResponse, + ValidatorsResponse, } from '../typeDefs/explorer-api'; function getFromCache(key: string) { @@ -33,8 +37,21 @@ function getFromCache(key: string) { function storeInCache(key: string, data: any) { localStorage.setItem(key, data); + localStorage.setItem('ts', Date.now().toString()); } + export class Api { + static fetchOverviewSummary = async (): Promise => { + const cache = getFromCache('overview-summary'); + if (cache) { + return cache; + } + const res = await fetch(`${OVERVIEW_API}/summary`); + const json = await res.json(); + storeInCache('overview-summary', JSON.stringify(json)); + return json; + }; + static fetchMixnodes = async (): Promise => { const cachedMixnodes = getFromCache('mixnodes'); if (cachedMixnodes) { @@ -43,18 +60,33 @@ export class Api { const res = await fetch(MIXNODES_API); const json = await res.json(); storeInCache('mixnodes', JSON.stringify(json)); - storeInCache('ts', Date.now()); + return json; + }; + + static fetchMixnodesActiveSetByStatus = async ( + status: MixnodeStatus, + ): Promise => { + const cachedMixnodes = getFromCache(`mixnodes-${status}`); + if (cachedMixnodes) { + return cachedMixnodes; + } + const res = await fetch(`${MIXNODES_API}/active-set/${status}`); + const json = await res.json(); + storeInCache(`mixnodes-${status}`, JSON.stringify(json)); return json; }; static fetchMixnodeByID = async ( id: string, ): Promise => { - const allMixnodes: MixNodeResponse = await Api.fetchMixnodes(); - const matchedByID = allMixnodes.filter( - (eachRecord) => eachRecord.mix_node.identity_key === id, - ); - return (matchedByID.length && matchedByID[0]) || undefined; + const response = await fetch(`${MIXNODE_API}/${id}`); + + // when the mixnode is not found, returned undefined + if (response.status === 404) { + return undefined; + } + + return response.json(); }; static fetchGateways = async (): Promise => { @@ -93,6 +125,11 @@ export class Api { static fetchStatsById = async (id: string): Promise => (await fetch(`${MIXNODE_API}/${id}/stats`)).json(); + static fetchMixnodeDescriptionById = async ( + id: string, + ): Promise => + (await fetch(`${MIXNODE_API}/${id}/description`)).json(); + static fetchStatusById = async (id: string): Promise => (await fetch(`${MIXNODE_PING}/${id}`)).json(); diff --git a/explorer/src/components/BondBreakdown.tsx b/explorer/src/components/BondBreakdown.tsx deleted file mode 100644 index d655e2b855..0000000000 --- a/explorer/src/components/BondBreakdown.tsx +++ /dev/null @@ -1,222 +0,0 @@ -import * as React from 'react'; -import { Alert, Box, CircularProgress, useMediaQuery } from '@mui/material'; -import { useTheme } from '@mui/material/styles'; -import Table from '@mui/material/Table'; -import TableBody from '@mui/material/TableBody'; -import TableCell from '@mui/material/TableCell'; -import TableContainer from '@mui/material/TableContainer'; -import TableHead from '@mui/material/TableHead'; -import TableRow from '@mui/material/TableRow'; -import Paper from '@mui/material/Paper'; -import { useMainContext } from 'src/context/main'; -import { ExpandMore } from '@mui/icons-material'; -import { currencyToString } from '../utils/currency'; - -export const BondBreakdownTable: React.FC = () => { - const { mixnodeDetailInfo, delegations } = useMainContext(); - const [allContentLoaded, setAllContentLoaded] = - React.useState(false); - const [showError, setShowError] = React.useState(false); - const [showDelegations, toggleShowDelegations] = - React.useState(false); - - const [bonds, setBonds] = React.useState({ - delegations: '0', - pledges: '0', - bondsTotal: '0', - hasLoaded: false, - }); - const theme = useTheme(); - const matches = useMediaQuery(theme.breakpoints.down('sm')); - - React.useEffect(() => { - if (mixnodeDetailInfo && mixnodeDetailInfo.data?.length) { - const thisMixnode = mixnodeDetailInfo?.data[0]; - - // delegations - const decimalisedDelegations = currencyToString( - thisMixnode.total_delegation.amount.toString(), - thisMixnode.total_delegation.denom, - ); - - // pledges - const decimalisedPledges = currencyToString( - thisMixnode.pledge_amount.amount.toString(), - thisMixnode.pledge_amount.denom, - ); - - // bonds total (del + pledges) - const pledgesSum = Number(thisMixnode.pledge_amount.amount); - const delegationsSum = Number(thisMixnode.total_delegation.amount); - const bondsTotal = currencyToString( - (delegationsSum + pledgesSum).toString(), - ); - - setBonds({ - delegations: decimalisedDelegations, - pledges: decimalisedPledges, - bondsTotal, - hasLoaded: true, - }); - } - }, [mixnodeDetailInfo]); - - React.useEffect(() => { - const hasError = Boolean(mixnodeDetailInfo?.error || delegations?.error); - const hasAllMixnodeInfo = Boolean( - mixnodeDetailInfo?.data !== undefined && - mixnodeDetailInfo?.data[0].mix_node, - ); - const hasAllDelegationsInfo = Boolean( - delegations?.data !== undefined && delegations?.data, - ); - const hasAllData = Boolean( - !hasError && hasAllMixnodeInfo && hasAllDelegationsInfo, - ); - setShowError(hasError); - setAllContentLoaded(hasAllData); - }, [mixnodeDetailInfo, delegations]); - - const expandDelegations = () => { - if (delegations?.data && delegations.data.length > 0) { - toggleShowDelegations(!showDelegations); - } - }; - const calcBondPercentage = (num: number) => { - if (mixnodeDetailInfo?.data !== undefined && mixnodeDetailInfo?.data[0]) { - const rawDelegationAmount = Number( - mixnodeDetailInfo.data[0].total_delegation.amount, - ); - const rawPledgeAmount = Number( - mixnodeDetailInfo.data[0].pledge_amount.amount, - ); - const rawTotalBondsAmount = rawDelegationAmount + rawPledgeAmount; - return ((num * 100) / rawTotalBondsAmount).toFixed(1); - } - return 0; - }; - - if (mixnodeDetailInfo?.isLoading) { - return ; - } - - if (showError) { - return ( - - We are unable to retrieve a Mixnode with that ID. Please try later or - Contact Us. - - ); - } - - if (!showError && allContentLoaded) { - return ( - <> - - - - - - Bond total - - - {bonds.bondsTotal} - - - - Pledge total - - {bonds.pledges} - - - - - - Delegation total {'\u00A0'} - {delegations?.data && delegations?.data?.length > 0 && ( - - )} - - - - {bonds.delegations} - - - -
- - {showDelegations && ( - - - - - - Delegators - - - Stake - - - Share from bond - - - - - - {delegations?.data?.map( - ({ owner, amount: { amount, denom } }) => ( - - - {owner} - - - {currencyToString(amount.toString(), denom)} - - - {calcBondPercentage(amount)}% - - - ), - )} - -
-
- )} -
- - ); - } - return null; -}; diff --git a/explorer/src/components/ContentCard.tsx b/explorer/src/components/ContentCard.tsx index 6c34396cf0..e1e7cf1407 100644 --- a/explorer/src/components/ContentCard.tsx +++ b/explorer/src/components/ContentCard.tsx @@ -2,7 +2,7 @@ import { Card, CardHeader, CardContent, Typography } from '@mui/material'; import React, { ReactEventHandler } from 'react'; type ContentCardProps = { - title?: string | React.ReactNode; + title?: React.ReactNode; subtitle?: string; Icon?: React.ReactNode; Action?: React.ReactNode; diff --git a/explorer/src/components/CustomColumnHeading.tsx b/explorer/src/components/CustomColumnHeading.tsx index c7b084b14e..00836a2d54 100644 --- a/explorer/src/components/CustomColumnHeading.tsx +++ b/explorer/src/components/CustomColumnHeading.tsx @@ -14,7 +14,7 @@ export const CustomColumnHeading: React.FC<{ headingTitle: string }> = ({ {columnsData?.map(({ field, title, flex }) => ( - + {title} ))} @@ -65,6 +65,7 @@ export const DetailTable: React.FC<{ ...cellStyles, padding: 2, width: 200, + fontSize: 14, }} data-testid={`${_.title.replace(/ /g, '-')}-value`} > diff --git a/explorer/src/components/Gateways.tsx b/explorer/src/components/Gateways.tsx new file mode 100644 index 0000000000..8a004285d1 --- /dev/null +++ b/explorer/src/components/Gateways.tsx @@ -0,0 +1,26 @@ +import * as React from 'react'; +import { GatewayResponse } from '../typeDefs/explorer-api'; + +export type GatewayRowType = { + id: string; + owner: string; + identity_key: string; + bond: number; + host: string; + location: string; +}; + +export function gatewayToGridRow( + arrayOfGateways: GatewayResponse, +): GatewayRowType[] { + return !arrayOfGateways + ? [] + : arrayOfGateways.map((gw) => ({ + id: gw.owner, + owner: gw.owner, + identity_key: gw.gateway.identity_key || '', + location: gw?.gateway?.location || '', + bond: gw.pledge_amount.amount || 0, + host: gw.gateway.host || '', + })); +} diff --git a/explorer/src/components/Icons.tsx b/explorer/src/components/Icons.tsx new file mode 100644 index 0000000000..5ba3c23c1b --- /dev/null +++ b/explorer/src/components/Icons.tsx @@ -0,0 +1,29 @@ +import * as React from 'react'; +import CheckCircleOutlineIcon from '@mui/icons-material/CheckCircleOutline'; +import PauseCircleOutlineIcon from '@mui/icons-material/PauseCircleOutline'; +import CircleOutlinedIcon from '@mui/icons-material/CircleOutlined'; +import { MixnodeStatus } from '../typeDefs/explorer-api'; + +export const Icons = { + mixnodes: { + status: { + active: CheckCircleOutlineIcon, + standby: PauseCircleOutlineIcon, + inactive: CircleOutlinedIcon, + }, + }, +}; + +export const getMixNodeIcon = (value: any) => { + if (value && typeof value === 'string') { + switch (value) { + case MixnodeStatus.active: + return Icons.mixnodes.status.active; + case MixnodeStatus.standby: + return Icons.mixnodes.status.standby; + default: + return Icons.mixnodes.status.inactive; + } + } + return Icons.mixnodes.status.inactive; +}; diff --git a/explorer/src/components/MixNodes/BondBreakdown.tsx b/explorer/src/components/MixNodes/BondBreakdown.tsx new file mode 100644 index 0000000000..186ad2ab59 --- /dev/null +++ b/explorer/src/components/MixNodes/BondBreakdown.tsx @@ -0,0 +1,194 @@ +import * as React from 'react'; +import { Alert, Box, CircularProgress, useMediaQuery } from '@mui/material'; +import { useTheme } from '@mui/material/styles'; +import Table from '@mui/material/Table'; +import TableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableContainer from '@mui/material/TableContainer'; +import TableHead from '@mui/material/TableHead'; +import TableRow from '@mui/material/TableRow'; +import Paper from '@mui/material/Paper'; +import { ExpandMore } from '@mui/icons-material'; +import { currencyToString } from '../../utils/currency'; +import { useMixnodeContext } from '../../context/mixnode'; + +export const BondBreakdownTable: React.FC = () => { + const { mixNode, delegations } = useMixnodeContext(); + const [showDelegations, toggleShowDelegations] = + React.useState(false); + + const [bonds, setBonds] = React.useState({ + delegations: '0', + pledges: '0', + bondsTotal: '0', + hasLoaded: false, + }); + const theme = useTheme(); + const matches = useMediaQuery(theme.breakpoints.down('sm')); + + React.useEffect(() => { + if (mixNode?.data) { + // delegations + const decimalisedDelegations = currencyToString( + mixNode.data.total_delegation.amount.toString(), + mixNode.data.total_delegation.denom, + ); + + // pledges + const decimalisedPledges = currencyToString( + mixNode.data.pledge_amount.amount.toString(), + mixNode.data.pledge_amount.denom, + ); + + // bonds total (del + pledges) + const pledgesSum = Number(mixNode.data.pledge_amount.amount); + const delegationsSum = Number(mixNode.data.total_delegation.amount); + const bondsTotal = currencyToString( + (delegationsSum + pledgesSum).toString(), + ); + + setBonds({ + delegations: decimalisedDelegations, + pledges: decimalisedPledges, + bondsTotal, + hasLoaded: true, + }); + } + }, [mixNode]); + + const expandDelegations = () => { + if (delegations?.data && delegations.data.length > 0) { + toggleShowDelegations(!showDelegations); + } + }; + const calcBondPercentage = (num: number) => { + if (mixNode?.data) { + const rawDelegationAmount = Number(mixNode.data.total_delegation.amount); + const rawPledgeAmount = Number(mixNode.data.pledge_amount.amount); + const rawTotalBondsAmount = rawDelegationAmount + rawPledgeAmount; + return ((num * 100) / rawTotalBondsAmount).toFixed(1); + } + return 0; + }; + + if (mixNode?.isLoading || delegations?.isLoading) { + return ; + } + + if (mixNode?.error) { + return Mixnode not found; + } + if (delegations?.error) { + return ( + Unable to get delegations for mixnode + ); + } + + return ( + <> + + + + + + Bond total + + + {bonds.bondsTotal} + + + + Pledge total + + {bonds.pledges} + + + + + + Delegation total {'\u00A0'} + {delegations?.data && delegations?.data?.length > 0 && ( + + )} + + + + {bonds.delegations} + + + +
+ + {showDelegations && ( + + + + + + Delegators + + + Stake + + + Share from bond + + + + + + {delegations?.data?.map( + ({ owner, amount: { amount, denom } }) => ( + + + {owner} + + + {currencyToString(amount.toString(), denom)} + + + {calcBondPercentage(amount)}% + + + ), + )} + +
+
+ )} +
+ + ); +}; diff --git a/explorer/src/components/MixNodes/DetailSection.tsx b/explorer/src/components/MixNodes/DetailSection.tsx new file mode 100644 index 0000000000..e3c235ceb3 --- /dev/null +++ b/explorer/src/components/MixNodes/DetailSection.tsx @@ -0,0 +1,106 @@ +import { Box, Button, Grid, Typography, useMediaQuery } from '@mui/material'; +import * as React from 'react'; +import Identicon from 'react-identicons'; +import { useTheme } from '@mui/material/styles'; +import { MixnodeRowType } from '.'; +import { getMixNodeStatusText, MixNodeStatus } from './Status'; +import { MixNodeDescriptionResponse } from '../../typeDefs/explorer-api'; + +interface MixNodeDetailProps { + mixNodeRow: MixnodeRowType; + mixnodeDescription: MixNodeDescriptionResponse; +} + +export const MixNodeDetailSection: React.FC = ({ + mixNodeRow, + mixnodeDescription, +}) => { + const theme = useTheme(); + const palette = [theme.palette.text.primary]; + const matches = useMediaQuery(theme.breakpoints.down('sm')); + const statusText = React.useMemo( + () => getMixNodeStatusText(mixNodeRow.status), + [mixNodeRow.status], + ); + return ( + + + + + + + + {mixnodeDescription.name} + + {(mixnodeDescription.description || '').slice(0, 1000)} + + + + + + + + + Node status: + + + + + + This node is {statusText} in this epoch + + + + + ); +}; diff --git a/explorer/src/components/MixNodes/Status.tsx b/explorer/src/components/MixNodes/Status.tsx new file mode 100644 index 0000000000..fe94fcb1b5 --- /dev/null +++ b/explorer/src/components/MixNodes/Status.tsx @@ -0,0 +1,53 @@ +import { Typography } from '@mui/material'; +import * as React from 'react'; +import { Theme, useTheme } from '@mui/material/styles'; +import { MixnodeRowType } from '.'; +import { getMixNodeIcon } from '../Icons'; +import { MixnodeStatus } from '../../typeDefs/explorer-api'; + +interface MixNodeStatusProps { + status: MixnodeStatus; +} + +export const MixNodeStatus: React.FC = ({ status }) => { + const theme = useTheme(); + const Icon = React.useMemo(() => getMixNodeIcon(status), [status]); + const color = React.useMemo(() => getMixNodeStatusColor(theme, status), [status, theme]); + + return ( + + + + {`${status[0].toUpperCase()}${status.slice(1)}`} + + + ); +}; + +export const getMixNodeStatusColor = (theme: Theme, status: MixnodeStatus) => { + let color; + switch (status) { + case MixnodeStatus.active: + color = theme.palette.nym.networkExplorer.mixnodes.status.active; + break; + case MixnodeStatus.standby: + color = theme.palette.nym.networkExplorer.mixnodes.status.standby; + break; + default: + color = theme.palette.nym.networkExplorer.mixnodes.status.inactive; + break; + } + return color; +}; + +// TODO: should be done with i18n +export const getMixNodeStatusText = (status: MixnodeStatus) => { + switch (status) { + case MixnodeStatus.active: + return 'active'; + case MixnodeStatus.standby: + return 'on standby'; + default: + return 'inactive'; + } +}; diff --git a/explorer/src/components/MixNodes/StatusDropdown.tsx b/explorer/src/components/MixNodes/StatusDropdown.tsx new file mode 100644 index 0000000000..420b726738 --- /dev/null +++ b/explorer/src/components/MixNodes/StatusDropdown.tsx @@ -0,0 +1,96 @@ +import { MenuItem, useMediaQuery } from '@mui/material'; +import * as React from 'react'; +import Select from '@mui/material/Select'; +import { SelectInputProps } from '@mui/material/Select/SelectInput'; +import { useTheme } from '@mui/material/styles'; +import { SxProps } from '@mui/system'; +import { MixNodeStatus } from './Status'; +import { + MixnodeStatus, + MixnodeStatusWithAll, +} from '../../typeDefs/explorer-api'; + +// TODO: replace with i18n +const ALL_NODES = 'All nodes'; + +interface MixNodeStatusDropdownProps { + status?: MixnodeStatusWithAll; + sx?: SxProps; + onSelectionChanged?: (status?: MixnodeStatusWithAll) => void; +} + +export const MixNodeStatusDropdown: React.FC = ({ + status, + onSelectionChanged, + sx, +}) => { + const theme = useTheme(); + const matches = useMediaQuery(theme.breakpoints.down('sm')); + const [statusValue, setStatusValue] = React.useState( + status || MixnodeStatusWithAll.all, + ); + const onChange: SelectInputProps['onChange'] = + React.useCallback( + ({ target: { value } }) => { + setStatusValue(value); + if (onSelectionChanged) { + onSelectionChanged(value); + } + }, + [onSelectionChanged], + ); + + return ( + + ); +}; + +MixNodeStatusDropdown.defaultProps = { + onSelectionChanged: undefined, + status: undefined, + sx: undefined, +}; diff --git a/explorer/src/components/MixNodes/index.ts b/explorer/src/components/MixNodes/index.ts new file mode 100644 index 0000000000..356cf6c38c --- /dev/null +++ b/explorer/src/components/MixNodes/index.ts @@ -0,0 +1,44 @@ +/* eslint-disable camelcase */ +import { + MixNodeResponse, + MixNodeResponseItem, + MixnodeStatus, +} from '../../typeDefs/explorer-api'; + +export type MixnodeRowType = { + id: string; + status: MixnodeStatus; + owner: string; + location: string; + identity_key: string; + bond: number; + self_percentage: string; + host: string; + layer: string; +}; + +export function mixnodeToGridRow( + arrayOfMixnodes?: MixNodeResponse, +): MixnodeRowType[] { + return (arrayOfMixnodes || []).map(mixNodeResponseItemToMixnodeRowType); +} + +export function mixNodeResponseItemToMixnodeRowType( + item: MixNodeResponseItem, +): MixnodeRowType { + const pledge = Number(item.pledge_amount.amount) || 0; + const delegations = Number(item.total_delegation.amount) || 0; + const totalBond = pledge + delegations; + const selfPercentage = ((pledge * 100) / totalBond).toFixed(2); + return { + id: item.owner, + status: item.status, + owner: item.owner, + identity_key: item.mix_node.identity_key || '', + bond: totalBond || 0, + location: item?.location?.country_name || '', + self_percentage: selfPercentage, + host: item?.mix_node?.host || '', + layer: item?.layer || '', + }; +} diff --git a/explorer/src/components/MobileNav.tsx b/explorer/src/components/MobileNav.tsx index 42189d148b..cfca612af8 100644 --- a/explorer/src/components/MobileNav.tsx +++ b/explorer/src/components/MobileNav.tsx @@ -81,7 +81,7 @@ export const MobileNav: React.FC<{ children: React.ReactNode }> = ({ sx={{ color: theme.palette.nym.networkExplorer.nav.text, fontSize: '18px', - fontWeight: 800, + fontWeight: 600, ml: 2, }} > diff --git a/explorer/src/components/Nav.tsx b/explorer/src/components/Nav.tsx index 0f94a3223e..2cbccea908 100644 --- a/explorer/src/components/Nav.tsx +++ b/explorer/src/components/Nav.tsx @@ -186,7 +186,7 @@ export const ExpandableButton: React.FC = ({ if (isChild) { setDynamicStyle({ background: palette.nym.networkExplorer.nav.selected.nested, - fontWeight: 800, + fontWeight: 600, }); } if (!nested && !isChild) { @@ -239,7 +239,7 @@ export const ExpandableButton: React.FC = ({ }} primaryTypographyProps={{ style: { - fontWeight: isActive ? 800 : 300, + fontWeight: isActive ? 600 : 400, }, }} /> @@ -314,6 +314,7 @@ export const Nav: React.FC = ({ children }) => { { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', - width: 205, ml: 0.5, }} > @@ -342,7 +342,7 @@ export const Nav: React.FC = ({ children }) => { sx={{ color: theme.palette.nym.networkExplorer.nav.text, fontSize: '18px', - fontWeight: 800, + fontWeight: 600, }} > { PaperProps={{ style: { background: theme.palette.nym.networkExplorer.nav.background, + borderRadius: 0, }, }} > @@ -427,7 +428,7 @@ export const Nav: React.FC = ({ children }) => { ))} - + {children}