Skip to content

Commit

Permalink
feat: added example ERC20 contract
Browse files Browse the repository at this point in the history
  • Loading branch information
10d9e committed May 6, 2024
1 parent 569a16b commit 9f15571
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions contracts/examples/DiscreteERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -115,39 +115,6 @@ contract DiscreteERC20 {
return true;
}

/// @notice Approves a spender to use a specified amount of the owner's tokens
/// @param spender The address authorized to spend the tokens
/// @param amount The amount of tokens they are authorized to use, represented as encrypted data
/// @return success A boolean value indicating success of the approval
function approve(
address spender,
Ciphertext calldata amount
) external returns (bool success) {
allowance[msg.sender][spender] = amount;
emit Approval(msg.sender, spender, amount);
return true;
}

/// @notice Transfers tokens from one address to another using an allowance
/// @param sender The address from which tokens are transferred
/// @param recipient The address to which tokens are transferred
/// @param amount The amount of tokens to transfer, represented as encrypted data
/// @return success A boolean value indicating success of the transfer
function transferFrom(
address sender,
address recipient,
Ciphertext calldata amount
) external returns (bool success) {
allowance[sender][msg.sender] = this._sub(
allowance[sender][msg.sender],
amount
);
balanceOf[sender] = this._sub(balanceOf[sender], amount);
balanceOf[recipient] = this._add(balanceOf[recipient], amount);
emit Transfer(sender, recipient, amount);
return true;
}

/// @dev Internal function to mint new encrypted tokens
/// @param to The address to receive the newly minted tokens
/// @param amount The amount of tokens to mint, represented as encrypted data
Expand Down

0 comments on commit 9f15571

Please sign in to comment.