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
let parser = new RSSParser(); | |
parser.parseURL('https://medium.com/feed/@alexroan/', function(err, feed) { | |
if (err) throw err; | |
for (let i = 0; i < 3; i++) { | |
const entry = feed.items[i]; | |
printPost(entry); | |
} | |
}); | |
function printPost(entry) { |
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.5.0; | |
import "../GSN/Context.sol"; | |
/** | |
* @dev Contract module which provides a basic access control mechanism, where | |
* there is an account (an owner) that can be granted exclusive access to | |
* specific functions. | |
* | |
* This module is used through inheritance. It will make available the modifier | |
* `onlyOwner`, which can be applied to your functions to restrict their use to |
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.5.0; | |
import "@openzeppelin/contracts/access/Roles.sol"; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; | |
contract MyToken is ERC20, ERC20Detailed { | |
using Roles for Roles.Role; | |
Roles.Role private _minters; |
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.5.0; | |
/** | |
* @title Roles | |
* @dev Library for managing addresses assigned to a Role. | |
*/ | |
library Roles { | |
struct Role { | |
mapping (address => bool) bearer; | |
} |
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.5.0; | |
/** | |
* @dev Wrappers over Solidity's arithmetic operations with added overflow | |
* checks. | |
* | |
* Arithmetic operations in Solidity wrap on overflow. This can easily result | |
* in bugs, because programmers usually assume that an overflow raises an | |
* error, which is the standard behavior in high level programming languages. | |
* `SafeMath` restores this intuition by reverting the transaction when an |
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.5.0; | |
/** | |
* @dev Wrappers over Solidity's uintXX casting operators with added overflow | |
* checks. | |
* | |
* Downcasting from uint256 in Solidity does not revert on overflow. This can | |
* easily result in undesired exploitation or bugs, since developers usually | |
* assume that overflows raise errors. `SafeCast` restores this intuition by |
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.5.0; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
import "@openzeppelin/contracts/token/ERC20/ERC20Detailed.sol"; | |
contract GLDToken is ERC20, ERC20Detailed { | |
constructor(uint256 initialSupply) ERC20Detailed("Gold", "GLD", 18) public { | |
_mint(msg.sender, initialSupply); | |
} | |
} |
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.5.0; | |
import "@openzeppelin/contracts/token/ERC721/ERC721Full.sol"; | |
import "@openzeppelin/contracts/drafts/Counters.sol"; | |
contract GameItem is ERC721Full { | |
using Counters for Counters.Counter; | |
Counters.Counter private _tokenIds; | |
constructor() ERC721Full("GameItem", "ITM") public { |
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.5.5; | |
import "@openzeppelin/contracts/utils/Address.sol"; | |
contract BasicUtils { | |
using Address for address; | |
function checkIfContract(address _addr) public { | |
return _addr.isContract(); | |
} |
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
// Tokens can only be transferred, minted or burned if the contract is not paused | |
contract ERC20Pausable is ERC20, Pausable { | |
function _beforeTokenTransfer(address from, address to, uint256 amount) | |
internal virtual override | |
{ | |
super._beforeTokenTransfer(from, to, amount); | |
require(!paused(), "ERC20Pausable: token transfer while paused"); | |
} | |
} |