The contract is an abstract implementation of a privacy-enhanced ERC20 token. It introduces mechanisms for handling encrypted balances, allowing for more secure and private token transfers. This contract integrates with the MPC Core library for secure multiparty computation (MPC).
Usage
Copy // SPDX-License-Identifier: MIT
pragma solidity 0.8.19;
import "@coti-io/coti-contracts/contracts/token/PrivateERC20/PrivateERC20.sol";
contract MyToken is PrivateERC20 {
constructor() PrivateERC20("Private Token", "PTOK") {}
}
Functions
Copy constructor(string memory name_, string memory symbol_)
Copy function name() view returns (string memory)
Copy function symbol() view returns (string memory)
Copy function decimals() view returns (uint8)
Copy function totalSupply() view returns (uint256)
Copy function accountEncryptionAddress(address account) view returns (address)
Copy function balanceOf(address account) view returns (ctUint64)
Copy function balanceOf() returns (gtUint64)
Copy function setAccountEncryptionAddress(address addr) returns (bool)
Copy function transfer(address to, itUint64 calldata value) returns (gtBool)
Copy function transfer(address to, gtUint64 value) returns (gtBool)
Copy function allowance(address owner, address spender) view returns (Allowance memory)
Copy function allowance(address account, bool isSpender) returns (gtUint64)
Copy function reencryptAllowance(address account, bool isSpender) returns (bool)
Copy function approve(address spender, itUint64 calldata value) returns (bool)
Copy function approve(address spender, gtUint64 value) returns (bool)
Copy function transferFrom(address from, address to, itUint64 calldata value) returns (gtBool)
Copy function transferFrom(address from, address to, gtUint64 value) returns (gtBool)
Copy function _transfer(address from, address to, gtUint64 value) returns (gtBool)
Copy function _update(address from, address to, gtUint64 value) returns (gtBool)
Copy function _getBalance(address account) returns (gtUint64)
Copy function _getAccountEncryptionAddress(address account) view returns (address)
Copy function _updateBalance(address account, gtUint64 balance)
Copy function _mint(address account, gtUint64 value) returns (gtBool)
Copy function _burn(address account, gtUint64 value) returns (gtBool)
Copy function _approve(address owner, address spender, gtUint64 value)
Copy function _spendAllowance(address owner, address spender, gtUint64 value)
Copy function _safeOnboard(ctUint64 value) returns (gtUint64)
Copy event Transfer(address indexed from, address indexed to, ctUint64 senderValue, ctUint64 receiverValue);
Copy event Approval(address indexed owner, address indexed spender, ctUint64 ownerValue, ctUint64 spenderValue);
Errors
Copy error ERC20InvalidSender(address sender)
Copy error ERC20InvalidReceiver(address receiver)
Copy error ERC20InvalidApprover(address approver)
Copy error ERC20InvalidSpender(address spender)