Skip to content

Commit 93a1f79

Browse files
Fix docs embed reference (#196)
* Fix docs embed reference * update line end * Standardize doc mocks --------- Co-authored-by: James Toussaint <33313130+james-toussaint@users.noreply.github.com>
1 parent 6980aa5 commit 93a1f79

File tree

3 files changed

+7
-12
lines changed

3 files changed

+7
-12
lines changed
Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,11 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.24;
33

4-
import {FHE, externalEuint64, ebool, euint64} from "@fhevm/solidity/lib/FHE.sol";
4+
import {FHE, externalEuint64} from "@fhevm/solidity/lib/FHE.sol";
55
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
66
import {ERC7984} from "../../token/ERC7984/ERC7984.sol";
77

88
contract ERC7984MintableBurnable is ERC7984, Ownable {
9-
using FHE for *;
10-
119
constructor(
1210
address owner,
1311
string memory name,
@@ -16,10 +14,10 @@ contract ERC7984MintableBurnable is ERC7984, Ownable {
1614
) ERC7984(name, symbol, uri) Ownable(owner) {}
1715

1816
function mint(address to, externalEuint64 amount, bytes memory inputProof) public onlyOwner {
19-
_mint(to, amount.fromExternal(inputProof));
17+
_mint(to, FHE.fromExternal(amount, inputProof));
2018
}
2119

2220
function burn(address from, externalEuint64 amount, bytes memory inputProof) public onlyOwner {
23-
_burn(from, amount.fromExternal(inputProof));
21+
_burn(from, FHE.fromExternal(amount, inputProof));
2422
}
2523
}

contracts/mocks/docs/SwapERC7984ToERC20.sol

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@ pragma solidity ^0.8.24;
44
import {FHE, externalEuint64, euint64} from "@fhevm/solidity/lib/FHE.sol";
55
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
66
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
7-
87
import {IERC7984} from "../../interfaces/IERC7984.sol";
98

109
contract SwapConfidentialToERC20 {
11-
using FHE for *;
12-
1310
error SwapConfidentialToERC20InvalidGatewayRequest(uint256 requestId);
1411

1512
mapping(uint256 requestId => address) private _receivers;
@@ -22,8 +19,8 @@ contract SwapConfidentialToERC20 {
2219
}
2320

2421
function swapConfidentialToERC20(externalEuint64 encryptedInput, bytes memory inputProof) public {
25-
euint64 amount = encryptedInput.fromExternal(inputProof);
26-
amount.allowTransient(address(_fromToken));
22+
euint64 amount = FHE.fromExternal(encryptedInput, inputProof);
23+
FHE.allowTransient(amount, address(_fromToken));
2724
euint64 amountTransferred = _fromToken.confidentialTransferFrom(msg.sender, address(this), amount);
2825

2926
bytes32[] memory cts = new bytes32[](1);

docs/modules/ROOT/pages/token.adoc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ Swapping from a confidential `ERC7984` to another confidential `ERC7984` is a bi
8080

8181
[source,solidity]
8282
----
83-
include::api:example$SwapERC7984ToERC7984.sol[lines=8..24]
83+
include::api:example$SwapERC7984ToERC7984.sol[lines=8..23]
8484
----
8585

8686
The steps are as follows:
@@ -97,6 +97,6 @@ Swapping from a confidential token to a non-confidential token is the most compl
9797

9898
[source,solidity]
9999
----
100-
include::api:example$SwapConfidentialToERC20.sol[]
100+
include::api:example$SwapERC7984ToERC20.sol[]
101101
----
102102

0 commit comments

Comments
 (0)