Hi everyone!
I'm trying to develop a TransparentUpgradeableContract but I'm facing many issues related to the contract itself. I'm currently using Remix IDE because it helps me to understand what's going on.
I took the code from the OpenZeppelin Github and I'm trying to understand it but I cannot understand some things. When I call the constructor of TransparentUpgreadbleProxy the third parameter is 'data' of type 'bytes' as shown here:
constructor(
address _logic,
address admin_,
bytes memory _data
) payable ERC1967Proxy(_logic, _data) {
assert(_ADMIN_SLOT == bytes32(uint256(keccak256("eip1967.proxy.admin")) - 1));
_changeAdmin(admin_);
}
What is that parameter? I can't figure it out by myself.
Then, once I deployed the contract how can I call the functions of my logic contract?
Here I have all the functions of my proxy contract, what about the functions of the logic contract?
Then I've got another question about the relationship between the logic contract and the proxy:
1 - let's say that I call the transfer(_to, _value) function that is in my logic contract;
2 - the receiver balance is the one he had before plus '_value';
3 - I keep track of the balances with my variable that is declared in my ProxyAccount:
mapping(address => uint256) private balances
4 - how can I notify the Proxy smart contract that the balance of _to is changed?
5 - I ask this because I read that the state of my contract must reside in the proxy meanwhile the logic is in the logic contract. But doing this I cannot understand how to change the state of my proxy from the logic smart contract
I hope I was clear enough and that you understood my problem, if not: let me know!
Peace
- N.V.