aavegotchi / aavegotchi-contracts

Aavegotchi diamond and its facets, deployment and upgrades. See the docs: https://docs.aavegotchi.com/
MIT License
316 stars 131 forks source link

Enable metatransactions throughout the contract #36

Closed cinnabarhorse closed 3 years ago

cinnabarhorse commented 3 years ago

Matic supports meta transactions (gasless transactions) and suggests we use Biconomy as a service provider. We will need to make some small changes to our smart contracts to enable these.

https://docs.biconomy.io/tutorials/native-meta-transactions

https://github.com/bcnmy/metatx-standard

cinnabarhorse commented 3 years ago

We can start by making a small demo contract and deploying to Mumbai with a demo UI so users can start experiencing metatransactions on Matic.

cinnabarhorse commented 3 years ago

@mudgen anything left to add for this? If not I will close.

mudgen commented 3 years ago

I have modified the metatransactions in the contract to work so that Ethereum can be connected in metamask but the metatransactions can be for Matic Network. But if we aren't going to do this, and I don't think we should, then I think I should change metatransactions back to the way they were before because I think that's more standard.

cinnabarhorse commented 3 years ago

Yes I agree, let's change them back to the original configuration.

mudgen commented 3 years ago

I think this is the only changes I need to make to the contract:

bytes32 internal constant EIP712_DOMAIN_TYPEHASH =
        keccak256(bytes("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"));

function domainSeparator(string memory name, string memory version) internal view returns (bytes32 domainSeparator_) {
  domainSeparator_ = keccak256(
  abi.encode(EIP712_DOMAIN_TYPEHASH, keccak256(bytes(name)), keccak256(bytes(version)), bytes32(getChainID()), address(this))
  );
}

I think you will have to make a related change in the UI.

It is done in the contract.

Commit: a1402828ed9cbea795b92c76aa28f53cae5afddf

mudgen commented 3 years ago

This is done in AavegotchiDiamond -- need to do it for GHSTStakingDiamond

cinnabarhorse commented 3 years ago

Completed.