diff --git a/packages/contracts-por/contracts/mocks/MockTrueCurrency.sol b/packages/contracts-por/contracts/mocks/MockTrueCurrency.sol index da22eb86b..08938b698 100644 --- a/packages/contracts-por/contracts/mocks/MockTrueCurrency.sol +++ b/packages/contracts-por/contracts/mocks/MockTrueCurrency.sol @@ -22,10 +22,10 @@ contract MockTrueCurrency is TrueCurrencyWithProofOfReserve { } function name() public pure override returns (string memory) { - return "TrueCurrency"; + return "TrueUSD"; } function symbol() public pure override returns (string memory) { - return "TCUR"; + return "TUSD"; } } diff --git a/packages/contracts-por/contracts/test/Registry.sol b/packages/contracts-por/contracts/test/Registry.sol index 338ac15eb..9d224b26c 100644 --- a/packages/contracts-por/contracts/test/Registry.sol +++ b/packages/contracts-por/contracts/test/Registry.sol @@ -3,7 +3,7 @@ pragma solidity 0.6.10; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; -import {IRegistryClone as RegistryClone} from "./IRegistryClone.sol"; +import {IRegistryClone} from "./IRegistryClone.sol"; contract Registry { struct AttributeData { @@ -28,13 +28,13 @@ contract Registry { // The logic governing who is allowed to set what attributes is abstracted as // this accessManager, so that it may be replaced by the owner as needed bytes32 constant WRITE_PERMISSION = keccak256("canWriteTo-"); - mapping(bytes32 => RegistryClone[]) subscribers; + mapping(bytes32 => IRegistryClone[]) subscribers; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); event SetAttribute(address indexed who, bytes32 attribute, uint256 value, bytes32 notes, address indexed adminAddr); event SetManager(address indexed oldManager, address indexed newManager); - event StartSubscription(bytes32 indexed attribute, RegistryClone indexed subscriber); - event StopSubscription(bytes32 indexed attribute, RegistryClone indexed subscriber); + event StartSubscription(bytes32 indexed attribute, IRegistryClone indexed subscriber); + event StopSubscription(bytes32 indexed attribute, IRegistryClone indexed subscriber); // Allows a write if either a) the writer is that Registry's owner, or // b) the writer is writing to attribute foo and that writer already has @@ -54,14 +54,14 @@ contract Registry { attributes[_who][_attribute] = AttributeData(_value, _notes, msg.sender, block.timestamp); emit SetAttribute(_who, _attribute, _value, _notes, msg.sender); - RegistryClone[] storage targets = subscribers[_attribute]; + IRegistryClone[] storage targets = subscribers[_attribute]; uint256 index = targets.length; while (index-- > 0) { targets[index].syncAttributeValue(_who, _attribute, _value); } } - function subscribe(bytes32 _attribute, RegistryClone _syncer) external onlyOwner { + function subscribe(bytes32 _attribute, IRegistryClone _syncer) external onlyOwner { subscribers[_attribute].push(_syncer); emit StartSubscription(_attribute, _syncer); } @@ -86,7 +86,7 @@ contract Registry { require(confirmWrite(_attribute, msg.sender)); attributes[_who][_attribute] = AttributeData(_value, "", msg.sender, block.timestamp); emit SetAttribute(_who, _attribute, _value, "", msg.sender); - RegistryClone[] storage targets = subscribers[_attribute]; + IRegistryClone[] storage targets = subscribers[_attribute]; uint256 index = targets.length; while (index-- > 0) { targets[index].syncAttributeValue(_who, _attribute, _value); @@ -130,10 +130,10 @@ contract Registry { uint256 _startIndex, address[] calldata _addresses ) external { - RegistryClone[] storage targets = subscribers[_attribute]; + IRegistryClone[] storage targets = subscribers[_attribute]; uint256 index = targets.length; while (index-- > _startIndex) { - RegistryClone target = targets[index]; + IRegistryClone target = targets[index]; for (uint256 i = _addresses.length; i-- > 0; ) { address who = _addresses[i]; target.syncAttributeValue(who, _attribute, attributes[who][_attribute].value); diff --git a/packages/contracts-por/package.json b/packages/contracts-por/package.json index 41b54af09..6cb570bac 100644 --- a/packages/contracts-por/package.json +++ b/packages/contracts-por/package.json @@ -17,7 +17,8 @@ "preflatten": "rm -rf custom_flatten", "flatten": "waffle flatten .waffle.json", "test": "mocha 'test/**/*.test.ts'", - "checks": "yarn lint && yarn test" + "checks": "yarn lint && yarn test", + "deploy": "ts-node scripts/deploy.ts" }, "dependencies": { "ethereum-mars": "0.2.5", @@ -36,6 +37,7 @@ "@types/node": "^17.0.34", "chai": "^4.3.6", "ethers": "^5.7.0", + "ethereum-waffle": "^3.4.0", "hardhat": "~2.10.2", "mocha": "^10.0.0", "ts-node": "^10.7.0", diff --git a/packages/contracts-por/scripts/deploy.ts b/packages/contracts-por/scripts/deploy.ts new file mode 100644 index 000000000..b2992dacb --- /dev/null +++ b/packages/contracts-por/scripts/deploy.ts @@ -0,0 +1,22 @@ +import { deployContract, MockProvider } from 'ethereum-waffle' +import { BigNumber, getDefaultProvider, Wallet } from 'ethers' +import { OwnedUpgradeabilityProxy__factory } from '../build/types/factories/OwnedUpgradeabilityProxy__factory' +import { providers } from 'ethers' +//import { InfuraProvider } from 'ethers/providers' + +export async function deploy() { + /* + what we need to configure: + 1. private key of wallet that we want to use for contract deployment + 2. infura key + 3. contract factory - factory of contract that we want to deploy + */ + const goerliChainId = 5 + const provider = new providers.InfuraProvider(goerliChainId, process.env.INFURA_KEY) + // const provider = getDefaultProvider(5) + const wallet = new Wallet(process.env.PRIVATE_KEY, provider) + const result = await deployContract(wallet, OwnedUpgradeabilityProxy__factory, [BigNumber.from(1000)] as any, { gasLimit: 2_000_000 }) + +} + +deploy()