See how a minor change to your commit message style can make you a better programmer.
Format: <type>(<scope>): <subject>
<scope>
is optional
//SPDX-License-Identifier: GPL-3.0 | |
pragma solidity 0.8.15; | |
import '@openzeppelin/contracts/utils/introspection/ERC165.sol'; | |
import '@openzeppelin/contracts/token/ERC721/ERC721.sol'; | |
contract Award is ERC721 { | |
constructor() ERC721('Award', 'A') { | |
_mint(msg.sender, 1337); | |
} |
// ==UserScript== | |
// @name Twitter Report | |
// @namespace http://tampermonkey.net/ | |
// @version 0.1 | |
// @description arc boost to report spam on twitter | |
// @author banteg | |
// @match *://twitter.com/* | |
// @icon https://www.google.com/s2/favicons?sz=64&domain=twitter.com | |
// @grant none | |
// ==/UserScript== |
Using newer compiler versions and the optimizer gives gas optimizations and additional safety checks for free!
The advantages of versions 0.8.*
over <0.8.0
are:
0.8.0
(can be more gas efficient than some
library based safemath.)0.8.2
, leads to cheaper runtime gas.
Especially relevant when the contract has small functions. For[ | |
{ | |
"wallet": "0xD5027f11fF85E22D95908fC8dd89C3C459612D23", | |
"tokenIds": [ | |
"1338", | |
"7196" | |
], | |
"type": "contract" | |
}, | |
{ |
// Data from: www.fohmo.io | |
const ohmForks = { | |
ETH: { | |
OHM: { | |
name: "OlympusDAO", | |
symbol: "OHM", | |
token: "0x383518188C0C6d7730D91b2c03a03C837814a899", | |
stakingSymbol: "sOHM", | |
stakingToken: "0x04F2694C8fcee23e8Fd0dfEA1d4f5Bb8c352111F", | |
stakingContract: "0xFd31c7d00Ca47653c6Ce64Af53c1571f9C36566a", |
// For reference: https://twitter.com/nanexcool/status/1396667368017997829 | |
pragma solidity ^0.5.7; | |
contract DeployContract { | |
function deploy(bytes memory code) public returns(address addr) { | |
assembly { | |
addr := create(0, add(code, 0x20), mload(code)) | |
if iszero(extcodesize(addr)) { | |
revert(0,0) |
const HelpIntentHandler = { | |
canHandle(handlerInput) { | |
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' | |
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'AMAZON.HelpIntent'; | |
}, | |
handle(handlerInput) { | |
const speakOutput = 'To know about the facts, just say Facts'; //just edit this | |
return handlerInput.responseBuilder | |
.speak(speakOutput) |
exports.handler = Alexa.SkillBuilders.custom() | |
.addRequestHandlers( | |
LaunchRequestHandler, | |
FactsIntentHandler, //your custom intent | |
HelloWorldIntentHandler, | |
HelpIntentHandler, | |
CancelAndStopIntentHandler, | |
SessionEndedRequestHandler, | |
IntentReflectorHandler, // make sure IntentReflectorHandler is last so it doesn't override your custom intent handlers | |
) |
const FactsIntentHandler = { | |
canHandle(handlerInput) { | |
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'IntentRequest' | |
&& Alexa.getIntentName(handlerInput.requestEnvelope) === 'FactsIntent'; | |
}, | |
handle(handlerInput) { | |
var random = factsList.facts[Math.floor(Math.random() * factsList.facts.length)]; //select a random fact from json file | |
var factText = random.text; | |
var speakOutput = "Did you know that " + factText; | |