Skip to content

Instantly share code, notes, and snippets.

@Neurone
Last active July 23, 2020 22:28
Show Gist options
  • Save Neurone/7f4de04ec5e3e926af27d5cd437aa8e2 to your computer and use it in GitHub Desktop.
Save Neurone/7f4de04ec5e3e926af27d5cd437aa8e2 to your computer and use it in GitHub Desktop.
Load this file into remix-ide (Realtime Ethereum Contract Compiler and Runtime) by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.9+commit.3e3065ac.js&optimize=false&gist=7f4de04ec5e3e926af27d5cd437aa8e2
// https://ethereum.stackexchange.com/questions/85231/array-of-mapping
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.5.0 <0.8.0;
contract myContract {
mapping (address => mapping (uint => uint)) public payments;
mapping (address => uint) public lastPayment;
function sendMoney() public payable {
require(msg.value > 0);
payments[msg.sender][lastPayment[msg.sender]] = msg.value;
lastPayment[msg.sender]++;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment