-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move v1 contracts still used to v2 directory (#447)
- Loading branch information
Showing
161 changed files
with
43,947 additions
and
156 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.7; | ||
|
||
/** | ||
* @dev Interface with connector custom errors | ||
*/ | ||
interface ConnectorErrors { | ||
// @dev Thrown when caller is not the address defined as paused address | ||
error CallerIsNotPauser(address caller); | ||
|
||
// @dev Thrown when caller is not the address defined as TSS address | ||
error CallerIsNotTss(address caller); | ||
|
||
// @dev Thrown when caller is not the address defined as TSS Updater address | ||
error CallerIsNotTssUpdater(address caller); | ||
|
||
// @dev Thrown when caller is not the address defined as TSS or TSS Updater address | ||
error CallerIsNotTssOrUpdater(address caller); | ||
|
||
// @dev Thrown when Zeta can't be transferred for some reason | ||
error ZetaTransferError(); | ||
|
||
// @dev Thrown when maxSupply will be exceed if minting will proceed | ||
error ExceedsMaxSupply(uint256 maxSupply); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.7; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | ||
|
||
/** | ||
* @dev ZetaEth is an implementation of OpenZeppelin's ERC20 | ||
*/ | ||
contract ZetaEth is ERC20("Zeta", "ZETA") { | ||
constructor(address creator, uint256 initialSupply) { | ||
_mint(creator, initialSupply * (10 ** uint256(decimals()))); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.0; | ||
|
||
import "@openzeppelin/contracts/token/ERC20/extensions/ERC20Burnable.sol"; | ||
|
||
import "./ZetaErrors.sol"; | ||
|
||
import "./ZetaNonEthInterface.sol"; | ||
|
||
contract ZetaNonEth is ZetaNonEthInterface, ERC20Burnable, ZetaErrors { | ||
address public connectorAddress; | ||
|
||
/** | ||
* @dev Collectively held by Zeta blockchain validators | ||
*/ | ||
address public tssAddress; | ||
|
||
/** | ||
* @dev Initially a multi-sig, eventually held by Zeta blockchain validators (via renounceTssAddressUpdater) | ||
*/ | ||
address public tssAddressUpdater; | ||
|
||
event Minted(address indexed mintee, uint256 amount, bytes32 indexed internalSendHash); | ||
|
||
event Burnt(address indexed burnee, uint256 amount); | ||
|
||
event TSSAddressUpdated(address callerAddress, address newTssAddress); | ||
|
||
event TSSAddressUpdaterUpdated(address callerAddress, address newTssUpdaterAddress); | ||
|
||
event ConnectorAddressUpdated(address callerAddress, address newConnectorAddress); | ||
|
||
constructor(address tssAddress_, address tssAddressUpdater_) ERC20("Zeta", "ZETA") { | ||
if (tssAddress_ == address(0) || tssAddressUpdater_ == address(0)) revert InvalidAddress(); | ||
|
||
tssAddress = tssAddress_; | ||
tssAddressUpdater = tssAddressUpdater_; | ||
} | ||
|
||
function updateTssAndConnectorAddresses(address tssAddress_, address connectorAddress_) external { | ||
if (msg.sender != tssAddressUpdater && msg.sender != tssAddress) revert CallerIsNotTssOrUpdater(msg.sender); | ||
if (tssAddress_ == address(0) || connectorAddress_ == address(0)) revert InvalidAddress(); | ||
|
||
tssAddress = tssAddress_; | ||
connectorAddress = connectorAddress_; | ||
|
||
emit TSSAddressUpdated(msg.sender, tssAddress_); | ||
emit ConnectorAddressUpdated(msg.sender, connectorAddress_); | ||
} | ||
|
||
/** | ||
* @dev Sets tssAddressUpdater to be tssAddress | ||
*/ | ||
function renounceTssAddressUpdater() external { | ||
if (msg.sender != tssAddressUpdater) revert CallerIsNotTssUpdater(msg.sender); | ||
if (tssAddress == address(0)) revert InvalidAddress(); | ||
|
||
tssAddressUpdater = tssAddress; | ||
emit TSSAddressUpdaterUpdated(msg.sender, tssAddress); | ||
} | ||
|
||
function mint(address mintee, uint256 value, bytes32 internalSendHash) external override { | ||
/** | ||
* @dev Only Connector can mint. Minting requires burning the equivalent amount on another chain | ||
*/ | ||
if (msg.sender != connectorAddress) revert CallerIsNotConnector(msg.sender); | ||
|
||
_mint(mintee, value); | ||
|
||
emit Minted(mintee, value, internalSendHash); | ||
} | ||
|
||
function burnFrom(address account, uint256 amount) public override(ZetaNonEthInterface, ERC20Burnable) { | ||
/** | ||
* @dev Only Connector can burn. | ||
*/ | ||
if (msg.sender != connectorAddress) revert CallerIsNotConnector(msg.sender); | ||
|
||
ERC20Burnable.burnFrom(account, amount); | ||
|
||
emit Burnt(account, amount); | ||
} | ||
} |
Oops, something went wrong.