Skip to content

Commit

Permalink
refactor: remove console.log in Domains contract
Browse files Browse the repository at this point in the history
  • Loading branch information
yk-saito committed Nov 28, 2023
1 parent 629c1ce commit cea85dd
Showing 1 changed file with 43 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,9 @@ mapping(uint => string) public names;
// コントラクトのどこかに付け加えてください。
function getAllNames() public view returns (string[] memory) {
console.log("Getting all names from contract");
string[] memory allNames = new string[](_tokenIds.current());
for (uint i = 0; i < _tokenIds.current(); i++) {
allNames[i] = names[i];
console.log("Name for token %d is %s", i, allNames[i]);
}
return allNames;
Expand Down Expand Up @@ -225,6 +223,41 @@ describe('ENS-Domain', () => {

```

次に、`Domains`コントラクト内で定義していた`console.log`を削除しましょう。

import文を削除します。

```solidity
// === 下記を削除 ===
import "hardhat/console.sol";
```

constructor関数内の`console.log`を削除します。

```solidity
// === 下記を削除 ===
console.log('%s name service deployed', _tld);
```

`register`関数内の`console.log`を削除します。

```solidity
// === 下記を削除 ===
console.log(
'Registering %s.%s on the contract with tokenID %d',
name,
tld,
newRecordId
);
```

```solidity
// === 下記を削除 ===
console.log('\n--------------------------------------------------------');
console.log('Final tokenURI', finalTokenUri);
console.log('--------------------------------------------------------\n');
```

では下のコマンドを実行することでコントラクトのテストをしていきましょう!

```
Expand All @@ -234,16 +267,18 @@ yarn test
最後に下のような結果がでいれば成功です!

```
✔ Token amount contract has is correct! (4986ms)
robber could not withdraw token
✔ someone not owenr cannot withdraw token (68ms)
Compiled 1 Solidity file successfully
ENS-Domain
✔ Token amount contract has is correct! (1417ms)
✔ someone not owenr cannot withdraw token
✔ contract owner can withdrawl token from conteract!
✔ Domain value is depend on how long it is (38ms)
✔ Domain value is depend on how long it is
4 passing (5s)
4 passing (1s)
✨ Done in 8.83s.
```

### 🙋‍♂️ 質問する
Expand Down

0 comments on commit cea85dd

Please sign in to comment.