# Snapshot report for `src/erc7984.test.ts`
The actual snapshot is saved in `erc7984.test.ts.snap`.
Generated by [AVA](https://avajs.dev).
## basic erc7984
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig {␊
constructor() ERC7984("MyToken", "MTK", "https://example.com/token") {}␊
}␊
`
## erc7984 name is unicodeSafe
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
␊
contract MyTokec is ERC7984, ZamaEthereumConfig {␊
constructor() ERC7984(unicode"MyTokeć", "MTK", "https://example.com/token") {}␊
}␊
`
## erc7984 preminted
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.5.0 and Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {FHE, euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig {␊
constructor(address recipient)␊
ERC7984("MyToken", "MTK", "https://example.com/token")␊
{␊
_mint(recipient, FHE.asEuint64(SafeCast.toUint64(1000 * 10 ** decimals())));␊
}␊
}␊
`
## erc7984 premint of 0
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig {␊
constructor() ERC7984("MyToken", "MTK", "https://example.com/token") {}␊
}␊
`
## erc7984 premint - max literal - valid
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.5.0 and Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {FHE, euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig {␊
constructor(address recipient)␊
ERC7984("MyToken", "MTK", "https://example.com/token")␊
{␊
_mint(recipient, FHE.asEuint64(SafeCast.toUint64(18446744073709551615 * 10 ** (decimals() - 6))));␊
}␊
}␊
`
## erc7984 premint - no arithmetic overflow - valid
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.5.0 and Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {FHE, euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig {␊
constructor(address recipient)␊
ERC7984("MyToken", "MTK", "https://example.com/token")␊
{␊
_mint(recipient, FHE.asEuint64(SafeCast.toUint64(18446744073709 * 10 ** decimals())));␊
}␊
}␊
`
## erc7984 premint - e notation - valid
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.5.0 and Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {FHE, euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig {␊
constructor(address recipient)␊
ERC7984("MyToken", "MTK", "https://example.com/token")␊
{␊
_mint(recipient, FHE.asEuint64(SafeCast.toUint64(10000000000000 * 10 ** decimals())));␊
}␊
}␊
`
## erc7984 wrappable
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.5.0 and Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
import {ERC7984ERC20Wrapper} from "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol";␊
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig, ERC7984ERC20Wrapper {␊
constructor(IERC20 underlying)␊
ERC7984("MyToken", "MTK", "https://example.com/token")␊
ERC7984ERC20Wrapper(underlying)␊
{}␊
␊
// The following functions are overrides required by Solidity.␊
␊
function _update(address from, address to, euint64 amount)␊
internal␊
override(ERC7984, ERC7984ERC20Wrapper)␊
returns (euint64 transferred)␊
{␊
return super._update(from, to, amount);␊
}␊
␊
function decimals()␊
public␊
view␊
override(ERC7984, ERC7984ERC20Wrapper)␊
returns (uint8)␊
{␊
return super.decimals();␊
}␊
}␊
`
## erc7984 votes + blocknumber
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.5.0 and Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
import {ERC7984Votes} from "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984Votes.sol";␊
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";␊
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig, EIP712, ERC7984Votes, AccessControl {␊
bytes32 public constant HANDLE_VIEWER_ROLE = keccak256("HANDLE_VIEWER_ROLE");␊
␊
constructor(address defaultAdmin, address handleViewer)␊
ERC7984("MyToken", "MTK", "https://example.com/token")␊
EIP712("MyToken", "1")␊
{␊
_grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);␊
_grantRole(HANDLE_VIEWER_ROLE, handleViewer);␊
}␊
␊
function _validateHandleAllowance(bytes32 handle)␊
internal␊
view␊
override␊
onlyRole(HANDLE_VIEWER_ROLE)␊
{}␊
␊
// The following functions are overrides required by Solidity.␊
␊
function supportsInterface(bytes4 interfaceId)␊
public␊
view␊
override(ERC7984, AccessControl)␊
returns (bool)␊
{␊
return super.supportsInterface(interfaceId);␊
}␊
␊
function _update(address from, address to, euint64 amount)␊
internal␊
override(ERC7984, ERC7984Votes)␊
returns (euint64 transferred)␊
{␊
return super._update(from, to, amount);␊
}␊
␊
function confidentialTotalSupply()␊
public␊
view␊
override(ERC7984, ERC7984Votes)␊
returns (euint64)␊
{␊
return super.confidentialTotalSupply();␊
}␊
}␊
`
## erc7984 votes + timestamp
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.5.0 and Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
import {ERC7984Votes} from "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984Votes.sol";␊
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";␊
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig, EIP712, ERC7984Votes, AccessControl {␊
bytes32 public constant HANDLE_VIEWER_ROLE = keccak256("HANDLE_VIEWER_ROLE");␊
␊
constructor(address defaultAdmin, address handleViewer)␊
ERC7984("MyToken", "MTK", "https://example.com/token")␊
EIP712("MyToken", "1")␊
{␊
_grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);␊
_grantRole(HANDLE_VIEWER_ROLE, handleViewer);␊
}␊
␊
function clock() public view override returns (uint48) {␊
return uint48(block.timestamp);␊
}␊
␊
// solhint-disable-next-line func-name-mixedcase␊
function CLOCK_MODE() public pure override returns (string memory) {␊
return "mode=timestamp";␊
}␊
␊
function _validateHandleAllowance(bytes32 handle)␊
internal␊
view␊
override␊
onlyRole(HANDLE_VIEWER_ROLE)␊
{}␊
␊
// The following functions are overrides required by Solidity.␊
␊
function supportsInterface(bytes4 interfaceId)␊
public␊
view␊
override(ERC7984, AccessControl)␊
returns (bool)␊
{␊
return super.supportsInterface(interfaceId);␊
}␊
␊
function _update(address from, address to, euint64 amount)␊
internal␊
override(ERC7984, ERC7984Votes)␊
returns (euint64 transferred)␊
{␊
return super._update(from, to, amount);␊
}␊
␊
function confidentialTotalSupply()␊
public␊
view␊
override(ERC7984, ERC7984Votes)␊
returns (euint64)␊
{␊
return super.confidentialTotalSupply();␊
}␊
}␊
`
## erc7984 full zama-ethereum
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.5.0 and Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {FHE, euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
import {ERC7984ERC20Wrapper} from "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol";␊
import {ERC7984Votes} from "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984Votes.sol";␊
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";␊
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";␊
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig, ERC7984ERC20Wrapper, EIP712, ERC7984Votes, AccessControl {␊
bytes32 public constant HANDLE_VIEWER_ROLE = keccak256("HANDLE_VIEWER_ROLE");␊
␊
constructor(address recipient, IERC20 underlying, address defaultAdmin, address handleViewer)␊
ERC7984("MyToken", "MTK", "https://example.com/token")␊
ERC7984ERC20Wrapper(underlying)␊
EIP712("MyToken", "1")␊
{␊
_mint(recipient, FHE.asEuint64(SafeCast.toUint64(2000 * 10 ** decimals())));␊
_grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);␊
_grantRole(HANDLE_VIEWER_ROLE, handleViewer);␊
}␊
␊
function _validateHandleAllowance(bytes32 handle)␊
internal␊
view␊
override␊
onlyRole(HANDLE_VIEWER_ROLE)␊
{}␊
␊
// The following functions are overrides required by Solidity.␊
␊
function supportsInterface(bytes4 interfaceId)␊
public␊
view␊
override(ERC7984, AccessControl)␊
returns (bool)␊
{␊
return super.supportsInterface(interfaceId);␊
}␊
␊
function _update(address from, address to, euint64 amount)␊
internal␊
override(ERC7984, ERC7984ERC20Wrapper, ERC7984Votes)␊
returns (euint64 transferred)␊
{␊
return super._update(from, to, amount);␊
}␊
␊
function confidentialTotalSupply()␊
public␊
view␊
override(ERC7984, ERC7984Votes)␊
returns (euint64)␊
{␊
return super.confidentialTotalSupply();␊
}␊
␊
function decimals()␊
public␊
view␊
override(ERC7984, ERC7984ERC20Wrapper)␊
returns (uint8)␊
{␊
return super.decimals();␊
}␊
}␊
`
## erc7984 full with timestamp votes
> Snapshot 1
`// SPDX-License-Identifier: MIT␊
// Compatible with OpenZeppelin Contracts ^5.5.0 and Confidential Contracts ^0.3.1␊
pragma solidity ^0.8.27;␊
␊
import {ZamaEthereumConfig} from "@fhevm/solidity/config/ZamaConfig.sol";␊
import {FHE, euint64} from "@fhevm/solidity/lib/FHE.sol";␊
import {ERC7984} from "@openzeppelin/confidential-contracts/token/ERC7984/ERC7984.sol";␊
import {ERC7984ERC20Wrapper} from "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984ERC20Wrapper.sol";␊
import {ERC7984Votes} from "@openzeppelin/confidential-contracts/token/ERC7984/extensions/ERC7984Votes.sol";␊
import {AccessControl} from "@openzeppelin/contracts/access/AccessControl.sol";␊
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";␊
import {EIP712} from "@openzeppelin/contracts/utils/cryptography/EIP712.sol";␊
import {SafeCast} from "@openzeppelin/contracts/utils/math/SafeCast.sol";␊
␊
contract MyToken is ERC7984, ZamaEthereumConfig, ERC7984ERC20Wrapper, EIP712, ERC7984Votes, AccessControl {␊
bytes32 public constant HANDLE_VIEWER_ROLE = keccak256("HANDLE_VIEWER_ROLE");␊
␊
constructor(address recipient, IERC20 underlying, address defaultAdmin, address handleViewer)␊
ERC7984("MyToken", "MTK", "https://example.com/token")␊
ERC7984ERC20Wrapper(underlying)␊
EIP712("MyToken", "1")␊
{␊
_mint(recipient, FHE.asEuint64(SafeCast.toUint64(2000 * 10 ** decimals())));␊
_grantRole(DEFAULT_ADMIN_ROLE, defaultAdmin);␊
_grantRole(HANDLE_VIEWER_ROLE, handleViewer);␊
}␊
␊
function clock() public view override returns (uint48) {␊
return uint48(block.timestamp);␊
}␊
␊
// solhint-disable-next-line func-name-mixedcase␊
function CLOCK_MODE() public pure override returns (string memory) {␊
return "mode=timestamp";␊
}␊
␊
function _validateHandleAllowance(bytes32 handle)␊
internal␊
view␊
override␊
onlyRole(HANDLE_VIEWER_ROLE)␊
{}␊
␊
// The following functions are overrides required by Solidity.␊
␊
function supportsInterface(bytes4 interfaceId)␊
public␊
view␊
override(ERC7984, AccessControl)␊
returns (bool)␊
{␊
return super.supportsInterface(interfaceId);␊
}␊
␊
function _update(address from, address to, euint64 amount)␊
internal␊
override(ERC7984, ERC7984ERC20Wrapper, ERC7984Votes)␊
returns (euint64 transferred)␊
{␊
return super._update(from, to, amount);␊
}␊
␊
function confidentialTotalSupply()␊
public␊
view␊
override(ERC7984, ERC7984Votes)␊
returns (euint64)␊
{␊
return super.confidentialTotalSupply();␊
}␊
␊
function decimals()␊
public␊
view␊
override(ERC7984, ERC7984ERC20Wrapper)␊
returns (uint8)␊
{␊
return super.decimals();␊
}␊
}␊
`