this refers to the instance of the contract where the call is made (you can have multiple instances of the same contract).
address(this) refers to the address of the instance of the contract where the call is being made.
msg.sender refers to the address where the contract is being called from.
Therefore, address(this) and msg.sender are two unique addresses, the first referring to the address of the contract instance and the second referring to the address where the contract call originated from.
Videos
this refers to the instance of the contract where the call is made (you can have multiple instances of the same contract).
address(this) refers to the address of the instance of the contract where the call is being made.
msg.sender refers to the address where the contract is being called from.
Therefore, address(this) and msg.sender are two unique addresses, the first referring to the address of the contract instance and the second referring to the address where the contract call originated from.
this is refers contract address. Contracts are non managable accounts which will not have any private key. That means if you created contract you don't have private key for contract A.
msg.sender = Contract caller (Who is calling your contract)
tx.origin = Transaction initiator
Refer bellow link for more details:
http://solidity.readthedocs.io/en/develop/units-and-global-variables.html
address[] is a type, an array of addresses. You can think of it as a list of addresses.
The square brackets, [], are use to specify that this type is an array.
You can create an array of many things, like an array of uint256 numbers:
uint256[] numbers;
And many more with a similar syntax.
Many languages use the [] to create or declare an array. Like Javascript: const numbers = [];. We can usually initiate an array with values, like in js: const numbers = [1,2,3,4,5];. In Solidity it would look like this for an array of uint256 numbers in storage: uint256[] numbers = [1,2,3,4];
In your case, an array of addresses can be declared as a state variable as follows:
address[] admins;
And then, in another function you can add addresses to that array:
function addAdmin(address adminAddress) public onlyOwner {
admins.push(adminAddress);
}
Of if you know the address before hand you can hard code them while you declare the array of addresses, like this:
address[] admins = [0x66B0b1d2930059407DcC30F1A2305435fc37315E, 0x6827b8f6cc60497d9bf5210d602C0EcaFDF7C405];
Arrays are really useful to hold a collection of things, objects, numbers, addresses, strings, etc.
We access arrays by index, starting at index 0 for the first element in most programming languages. If I want to access the first element of the array, then I do:
admins[0];
For the second:
admins[1];
And so on. Or in a loop:
for(uint256 i = 0; i < admins.length; i++) {
address adminAddress = admins[i];
// ...
// do something with adminAddress
}
And so on.
Solidity has many rules for arrays. State and local arrays are usually declared differently and used a bit differently in some cases. To learn more about them you can check the documentation: https://docs.soliditylang.org/en/latest/types.html#arrays
I hope it has helped.
In Solidity, address[] is an array consisting of addresses.
See: How can I instantiate an array of addresses?