Skip to content

Commit

Permalink
Deployed contracts on testnet and mainnet
Browse files Browse the repository at this point in the history
- Deployed all v1 contracts on Rootstock Testnet and `BalanceHelper` and `BalanceHelperV2` on Rootstock Mainnet.
- Added chain configs for Rootstock Mainnet.
- Added `balanceHelpers` tag on deployment script to make it easier to solely deploy balance helper contracts.
-Upgraded hardhat-etherscan package to later version.
  • Loading branch information
cryptonoyaiba committed Apr 3, 2024
1 parent 0965bc3 commit 299a535
Show file tree
Hide file tree
Showing 24 changed files with 9,048 additions and 763 deletions.
1,018 changes: 517 additions & 501 deletions DEPLOYMENTS.md

Large diffs are not rendered by default.

8 changes: 3 additions & 5 deletions deploy/001_create-common.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { DeployFunction } from "hardhat-deploy/types";

const func: DeployFunction = async hre => {
const {
deployments: { deploy },
getNamedAccounts,
} = hre;
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { from } = await getNamedAccounts();

await deploy("BalancesHelper", {
Expand All @@ -18,6 +16,6 @@ const func: DeployFunction = async hre => {
});
};

func.tags = ["create", "common"];
func.tags = ["create", "common", "balanceHelpers"];

module.exports = func;
1 change: 1 addition & 0 deletions deployments/rootstock/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
30
81 changes: 81 additions & 0 deletions deployments/rootstock/BalancesHelper.json

Large diffs are not rendered by default.

160 changes: 160 additions & 0 deletions deployments/rootstock/BalancesHelperV2.json

Large diffs are not rendered by default.

Large diffs are not rendered by default.

157 changes: 157 additions & 0 deletions deployments/rootstock/solcInputs/c6bcc786074bb5f47af1ba8ec29021b3.json

Large diffs are not rendered by default.

18 changes: 1 addition & 17 deletions deployments/rootstockTestnet/BalancesHelper.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0xa6C165E3539A2bE6d55e2935EC9979D8C850A21b",
"address": "0x4e732E6E7b64151b3b3a8034865F96a696eb010F",
"abi": [
{
"inputs": [
Expand All @@ -26,22 +26,6 @@
"type": "function"
}
],
"transactionHash": "0xc555d25843543f2099c5f5b28e5759c58819e55d56d10332924208cb462044a6",
"receipt": {
"to": "0x4e59b44847b379578588920cA78FbF26c0B4956C",
"from": "0x53fE9288897e254698175740aa359E19E26c10af",
"contractAddress": null,
"transactionIndex": 0,
"gasUsed": "420418",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xf94f2464b2d02284c70b57a2c7ce586bf32211c4365b0b40292d1ca68b1e4fbc",
"transactionHash": "0xc555d25843543f2099c5f5b28e5759c58819e55d56d10332924208cb462044a6",
"logs": [],
"blockNumber": 4971408,
"cumulativeGasUsed": "420418",
"status": 1,
"byzantium": true
},
"args": [],
"solcInputHash": "c6bcc786074bb5f47af1ba8ec29021b3",
"metadata": "{\"compiler\":{\"version\":\"0.6.12+commit.27d51765\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[{\"internalType\":\"address[]\",\"name\":\"accounts\",\"type\":\"address[]\"},{\"internalType\":\"address[]\",\"name\":\"tokens\",\"type\":\"address[]\"}],\"name\":\"getBalances\",\"outputs\":[{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"author\":\"Jegor Sidorenko <[email protected]>Stanis\\u0142aw G\\u0142ogowski <[email protected]>\",\"kind\":\"dev\",\"methods\":{\"getBalances(address[],address[])\":{\"details\":\"Pass 0x0 as a \\\"token\\\" address to get ETH balance. Possible error throws: - extremely large arrays for account and or tokens (gas cost too high)\",\"params\":{\"accounts\":\"array of accounts addresses\",\"tokens\":\"array of tokens addresses\"},\"returns\":{\"_0\":\"a one-dimensional that's user.length * tokens.length long. The array is ordered by all of the 0th accounts token balances, then the 1th user, and so on.\"}}},\"title\":\"Balances helper\",\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"getBalances(address[],address[])\":{\"notice\":\"Checks the token balances of accounts for multiple tokens.\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"src/common/helpers/BalancesHelper.sol\":\"BalancesHelper\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"none\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"src/common/helpers/BalancesHelper.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.6.12;\\n\\nimport \\\"../token/ERC20Token.sol\\\";\\nimport \\\"../libs/SafeMathLib.sol\\\";\\n\\n\\n/**\\n * @title Balances helper\\n *\\n * @author Jegor Sidorenko <[email protected]>\\n * @author Stanis\\u0142aw G\\u0142ogowski <[email protected]>\\n */\\ncontract BalancesHelper {\\n using SafeMathLib for uint256;\\n\\n // external functions\\n\\n /**\\n * @notice Checks the token balances of accounts for multiple tokens.\\n * @dev Pass 0x0 as a \\\"token\\\" address to get ETH balance.\\n *\\n * Possible error throws:\\n * - extremely large arrays for account and or tokens (gas cost too high)\\n *\\n * @param accounts array of accounts addresses\\n * @param tokens array of tokens addresses\\n * @return a one-dimensional that's user.length * tokens.length long. The\\n * array is ordered by all of the 0th accounts token balances, then the 1th\\n * user, and so on.\\n */\\n function getBalances(\\n address[] calldata accounts,\\n address[] calldata tokens\\n )\\n external\\n view\\n returns (uint[] memory)\\n {\\n uint[] memory result = new uint[](accounts.length.mul(tokens.length));\\n\\n for (uint i = 0; i < accounts.length; i++) {\\n for (uint j = 0; j < tokens.length; j++) {\\n uint index = j.add(tokens.length.mul(i));\\n\\n if (tokens[j] != address(0x0)) {\\n result[index] = _getBalance(accounts[i], tokens[j]);\\n } else {\\n result[index] = accounts[i].balance;\\n }\\n }\\n }\\n\\n return result;\\n }\\n\\n // private functions\\n\\n function _getBalance(\\n address account,\\n address token\\n )\\n private\\n view\\n returns (uint256)\\n {\\n uint256 result = 0;\\n uint256 tokenCode;\\n\\n /// @dev check if token is actually a contract\\n // solhint-disable-next-line no-inline-assembly\\n assembly { tokenCode := extcodesize(token) } // contract code size\\n\\n if (tokenCode > 0) {\\n /// @dev is it a contract and does it implement balanceOf\\n // solhint-disable-next-line avoid-low-level-calls\\n (bool methodExists,) = token.staticcall(abi.encodeWithSelector(\\n ERC20Token(token).balanceOf.selector,\\n account\\n ));\\n\\n if (methodExists) {\\n result = ERC20Token(token).balanceOf(account);\\n }\\n }\\n\\n return result;\\n }\\n}\\n\",\"keccak256\":\"0x76a5729807b8581731967ea74fc5e16a2c5c9067457c9059da97f089ffff68b9\",\"license\":\"MIT\"},\"src/common/libs/SafeMathLib.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.6.12;\\n\\n/**\\n * @title Safe math library\\n *\\n * @dev Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/math/SafeMath.sol\\n */\\nlibrary SafeMathLib {\\n function add(uint256 a, uint256 b) internal pure returns (uint256) {\\n uint256 c = a + b;\\n\\n require(c >= a, \\\"SafeMathLib: addition overflow\\\");\\n\\n return c;\\n }\\n\\n function sub(uint256 a, uint256 b) internal pure returns (uint256) {\\n return sub(a, b, \\\"SafeMathLib: subtraction overflow\\\");\\n }\\n\\n function sub(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b <= a, errorMessage);\\n\\n return a - b;\\n }\\n\\n function mul(uint256 a, uint256 b) internal pure returns (uint256) {\\n if (a == 0) {\\n return 0;\\n }\\n\\n uint256 c = a * b;\\n\\n require(c / a == b, \\\"SafeMathLib: multiplication overflow\\\");\\n\\n return c;\\n }\\n\\n function div(uint256 a, uint256 b) internal pure returns (uint256) {\\n return div(a, b, \\\"SafeMathLib: division by zero\\\");\\n }\\n\\n function div(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b > 0, errorMessage);\\n\\n return a / b;\\n }\\n\\n function mod(uint256 a, uint256 b) internal pure returns (uint256) {\\n return mod(a, b, \\\"SafeMathLib: modulo by zero\\\");\\n }\\n\\n function mod(uint256 a, uint256 b, string memory errorMessage) internal pure returns (uint256) {\\n require(b != 0, errorMessage);\\n\\n return a % b;\\n }\\n}\\n\",\"keccak256\":\"0x6089f354ca754d9c5dd9e800ee5ed86717dbf8f9af470604e0be691ac57c0107\",\"license\":\"MIT\"},\"src/common/token/ERC20Token.sol\":{\"content\":\"// SPDX-License-Identifier: MIT\\npragma solidity ^0.6.12;\\n\\nimport \\\"../libs/SafeMathLib.sol\\\";\\n\\n\\n/**\\n * @title ERC20 token\\n *\\n * @dev Based on https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.3.0/contracts/token/ERC20/ERC20.sol\\n */\\ncontract ERC20Token {\\n using SafeMathLib for uint256;\\n\\n string public name;\\n string public symbol;\\n uint8 public decimals;\\n uint256 public totalSupply;\\n\\n mapping(address => uint256) internal balances;\\n mapping(address => mapping(address => uint256)) internal allowances;\\n\\n // events\\n\\n event Transfer(\\n address indexed from,\\n address indexed to,\\n uint256 value\\n );\\n\\n event Approval(\\n address indexed owner,\\n address indexed spender,\\n uint256 value\\n );\\n\\n /**\\n * @dev internal constructor\\n */\\n constructor() internal {}\\n\\n // external functions\\n\\n function transfer(\\n address to,\\n uint256 value\\n )\\n external\\n returns (bool)\\n {\\n _transfer(_getSender(), to, value);\\n\\n return true;\\n }\\n\\n function transferFrom(\\n address from,\\n address to,\\n uint256 value\\n )\\n virtual\\n external\\n returns (bool)\\n {\\n address sender = _getSender();\\n\\n _transfer(from, to, value);\\n _approve(from, sender, allowances[from][sender].sub(value));\\n\\n return true;\\n }\\n\\n function approve(\\n address spender,\\n uint256 value\\n )\\n virtual\\n external\\n returns (bool)\\n {\\n _approve(_getSender(), spender, value);\\n\\n return true;\\n }\\n\\n // external functions (views)\\n\\n function balanceOf(\\n address owner\\n )\\n virtual\\n external\\n view\\n returns (uint256)\\n {\\n return balances[owner];\\n }\\n\\n function allowance(\\n address owner,\\n address spender\\n )\\n virtual\\n external\\n view\\n returns (uint256)\\n {\\n return allowances[owner][spender];\\n }\\n\\n // internal functions\\n\\n function _transfer(\\n address from,\\n address to,\\n uint256 value\\n )\\n virtual\\n internal\\n {\\n require(\\n from != address(0),\\n \\\"ERC20Token: cannot transfer from 0x0 address\\\"\\n );\\n require(\\n to != address(0),\\n \\\"ERC20Token: cannot transfer to 0x0 address\\\"\\n );\\n\\n balances[from] = balances[from].sub(value);\\n balances[to] = balances[to].add(value);\\n\\n emit Transfer(from, to, value);\\n }\\n\\n function _approve(\\n address owner,\\n address spender,\\n uint256 value\\n )\\n virtual\\n internal\\n {\\n require(\\n owner != address(0),\\n \\\"ERC20Token: cannot approve from 0x0 address\\\"\\n );\\n require(\\n spender != address(0),\\n \\\"ERC20Token: cannot approve to 0x0 address\\\"\\n );\\n\\n allowances[owner][spender] = value;\\n\\n emit Approval(owner, spender, value);\\n }\\n\\n function _mint(\\n address owner,\\n uint256 value\\n )\\n virtual\\n internal\\n {\\n require(\\n owner != address(0),\\n \\\"ERC20Token: cannot mint to 0x0 address\\\"\\n );\\n require(\\n value > 0,\\n \\\"ERC20Token: cannot mint 0 value\\\"\\n );\\n\\n balances[owner] = balances[owner].add(value);\\n totalSupply = totalSupply.add(value);\\n\\n emit Transfer(address(0), owner, value);\\n }\\n\\n function _burn(\\n address owner,\\n uint256 value\\n )\\n virtual\\n internal\\n {\\n require(\\n owner != address(0),\\n \\\"ERC20Token: cannot burn from 0x0 address\\\"\\n );\\n\\n balances[owner] = balances[owner].sub(\\n value,\\n \\\"ERC20Token: burn value exceeds balance\\\"\\n );\\n\\n totalSupply = totalSupply.sub(value);\\n\\n emit Transfer(owner, address(0), value);\\n }\\n\\n // internal functions (views)\\n\\n function _getSender()\\n virtual\\n internal\\n view\\n returns (address)\\n {\\n return msg.sender;\\n }\\n}\\n\",\"keccak256\":\"0x6f2b0bd08da549c6c1f5ceee85766832d587dde62c56bebc3a14bd9ea407e03d\",\"license\":\"MIT\"}},\"version\":1}",
Expand Down
10 changes: 5 additions & 5 deletions deployments/rootstockTestnet/BalancesHelperV2.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"address": "0xe5A160F89f330cc933816E896a3F36376DE0a835",
"address": "0x9B5213EbF6C5C014B1422085E2af36e29f41fd71",
"abi": [
{
"inputs": [],
Expand Down Expand Up @@ -87,18 +87,18 @@
"type": "function"
}
],
"transactionHash": "0x942aecf955825c92ba7861bba47a5d944971fc4e16a19f9fdefa35697f8d1470",
"transactionHash": "0xb8c3aa54d38ece7a6d1738b6359500e1fe278348d1275ed4b52210d5b990f426",
"receipt": {
"to": "0x4e59b44847b379578588920cA78FbF26c0B4956C",
"from": "0x53fE9288897e254698175740aa359E19E26c10af",
"contractAddress": null,
"transactionIndex": 0,
"gasUsed": "964203",
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"blockHash": "0xa3edb5cb8cbce6ea466e8dc6ce450cff01861012b320ec5e8059a804c6810503",
"transactionHash": "0x942aecf955825c92ba7861bba47a5d944971fc4e16a19f9fdefa35697f8d1470",
"blockHash": "0xe6733512302bd2f31e050831ce90907b05117b14b3bedd415ea164dff564c122",
"transactionHash": "0xb8c3aa54d38ece7a6d1738b6359500e1fe278348d1275ed4b52210d5b990f426",
"logs": [],
"blockNumber": 4971410,
"blockNumber": 4974680,
"cumulativeGasUsed": "964203",
"status": 1,
"byzantium": true
Expand Down
Loading

0 comments on commit 299a535

Please sign in to comment.