This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.17; | |
import "./SafeMath.sol"; | |
import "./provableAPI.sol"; | |
contract LeaseGenerator is usingProvable { | |
using SafeMath for uint; | |
address payable landlordAddress; | |
address payable tenantAddress; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Cheque = artifacts.require("./Cheque.sol"); | |
module.exports = function (deployer) { | |
deployer.deploy(Cheque, { value: 1e18 }); | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
networks: { | |
development: { | |
host: "127.0.0.1", | |
port: 8545, | |
network_id: "*", | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Web3 = require('web3') | |
const web3 = new Web3('ws://localhost:8545') | |
const fs = require('fs'); | |
const rawCheque = fs.readFileSync('./build/contracts/Cheque.json') | |
const parsedCheque = JSON.parse(rawCheque) | |
const contractAddress = parsedCheque.networks['5777'].address | |
let signPayment = async (recipient, amount) => { | |
const accounts = await web3.eth.getAccounts() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
contract Cheque { | |
mapping (uint => bool) usedNonces; | |
address owner; | |
constructor() public payable { | |
owner = msg.sender; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
contract Cheque { | |
mapping (uint => bool) usedNonces; | |
address owner; | |
constructor() public payable { | |
owner = msg.sender; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
contract Cheque { | |
mapping (uint => bool) usedNonces; | |
address owner; | |
constructor() public payable { | |
owner = msg.sender; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function claimPayment(uint amount, uint nonce, bytes memory sig) public { | |
require(!usedNonces[nonce], "Nonce has already been used"); | |
usedNonces[nonce] = true; | |
bytes32 message = prefixed(keccak256(abi.encodePacked(msg.sender, amount, nonce, this))); | |
require(recoverSigner(message, sig) == owner, "Signer is not owner"); | |
msg.sender.transfer(amount); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.5.0; | |
contract Cheque { | |
mapping (uint => bool) usedNonces; | |
address owner; | |
constructor() public payable { | |
owner = msg.sender; | |
} | |
} |
NewerOlder