This section explains how to get your own contract address in Solidity.
Syntax
To get your own contract address in Solidity, do the following.
address(this)
Sample Code
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Test {
function getMyAddress() public view returns(address) {
// get own contract address
return address(this);
}
}

“this” means the own contract. By passing it as an argument to the address function, you can get the address of your own contract.