This file contains hidden or 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
it('deployed successfully', async () => { | |
const address = await this.contract.address | |
assert.notEqual(address, 0x0) | |
assert.notEqual(address, '') | |
assert.notEqual(address, null) | |
assert.notEqual(address, undefined) | |
}) |
This file contains hidden or 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
// SPDX-License-Identifier: MIT | |
pragma solidity >=0.4.22 <0.9.0; | |
contract Persssist { | |
string public name = "Persssist"; | |
uint256 public fileCount = 0; | |
// this mapping behaves as a "catalog" | |
// of files uploaded to the storage, we declare | |
// it as public in order to access it directly from the Frontend |
This file contains hidden or 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.7.0 <0.9.0; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/cryptography/ECDSA.sol"; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/utils/ReentrancyGuard.sol"; | |
contract UniDirectionalPaymentChannel is ReentrancyGuard { | |
using ECDSA for bytes32; | |
address payable public sender; | |
address payable public receiver; |
This file contains hidden or 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.7.0 <0.9.0; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/cryptography/ECDSA.sol"; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/utils/ReentrancyGuard.sol"; | |
contract UniDirectionalPaymentChannel is ReentrancyGuard { | |
// ... | |
This file contains hidden or 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.7.0 <0.9.0; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/cryptography/ECDSA.sol"; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/utils/ReentrancyGuard.sol"; | |
contract UniDirectionalPaymentChannel is ReentrancyGuard { | |
// ... | |
function _verify(uint _amount, bytes memory _sig) private view returns (bool) { |
This file contains hidden or 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.7.0 <0.9.0; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/cryptography/ECDSA.sol"; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/utils/ReentrancyGuard.sol"; | |
contract UniDirectionalPaymentChannel is ReentrancyGuard { | |
// ... | |
function _getHash(uint _amount) private view returns (bytes32) { |
This file contains hidden or 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.7.0 <0.9.0; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/cryptography/ECDSA.sol"; | |
import "github.com/OpenZeppelin/openzeppelin-contracts/blob/release-v3.3/contracts/utils/ReentrancyGuard.sol"; | |
contract UniDirectionalPaymentChannel is ReentrancyGuard { | |
using ECDSA for bytes32; | |
address payable public sender; | |
address payable public receiver; |
This file contains hidden or 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.7.0 <0.9.0; | |
contract Chat { | |
function sendMessage(string _text) public { | |
lastMessageId++; | |
// loads the message into the list. | |
messageList[messageIdCounter] = Message( | |
lastMessageId, |
This file contains hidden or 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.7.0 <0.9.0; | |
contract Chat { | |
// the list of old messages in the chat | |
mapping(uint => Message) public messagesList; | |
function listMessages() public constant returns (uint[]){ | |
// if the chat is empty | |
if(lastMessageId == 0) { |
This file contains hidden or 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.7.0 <0.9.0; | |
contract Chat { | |
// ... | |
// We can use an autoincremental id for each new message. | |
uint lastMessageId; | |
function sendMessage(string _text) public { |