ReasonJun

Hardhat : ethers.constants.AddressZero 본문

Blockchain/HardHat

Hardhat : ethers.constants.AddressZero

ReasonJun 2023. 10. 21. 18:18
728x90

The ethers.constants.AddressZero constant is a special address that represents the null address. This address is used to represent the address of the contract that is creating tokens.

 

The null address is a special address that is not associated with any account. It is used to represent the absence of an address. For example, if a token is transferred to the null address, the token is effectively burned.

 

The null address is also used to represent the address of the contract that is creating tokens. This is because the contract itself does not have an address. When a contract creates tokens, the tokens are created with the address of the contract. However, the contract itself does not have an address, so the null address is used instead.

 

The ethers.constants.AddressZero constant is a convenient way to refer to the null address. It is also a safe way to refer to the null address, as it is guaranteed to be the correct address.

 

In the example you provided, the ethers.constants.AddressZero constant is being used to assert that the Transfer event is being emitted with the address of the contract as the sender. This is because the contract is creating the tokens that are being transferred.

 

728x90
Comments