View TestRawCall.vy
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
# # SPDX-License-Identifier: MIT | |
# # @version ^0.3.3 | |
# val: public(uint256) | |
# @external | |
# def runRawCall(newVal: uint256, myAdd: address): | |
# # call_data: Bytes[3236] = _abi_encode(requestId, words, method_id=method_id("rawFulfillRandomWords")) | |
# # call_data: Bytes[68] = concat(method_id("rawFulfillRandomWords"), convert(requestId, bytes32), convert(words, bytes32)) | |
# call_data: Bytes[36] = _abi_encode(newVal, method_id=method_id("funcToCall(uint256)")) |
View MeMo.sol
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
interface IMo{ | |
function callMeDifferentContract() external returns(address); | |
} | |
contract Me{ | |
address public senderOne; |
View StringConcater.sol
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
// SPDX-License-Identifier: MIT | |
pragma solidity 0.8.12; | |
contract StringConcater { | |
// only in 0.8.12 and above | |
function concatStringsNewWay() public pure returns(string memory){ | |
string memory hiMom = "Hi Mom, "; | |
string memory missYou = "miss you."; | |
return string.concat(hiMom, missYou); |
View SelectorsAndSignatures.sol
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.7; | |
contract SelectorsAndSignatures { | |
address public s_someAddress; | |
uint256 public s_amount; | |
function getSelectorOne() public pure returns(bytes4 selector){ | |
selector = bytes4(keccak256(bytes("transfer(address,uint256)"))); | |
} |
View ErrorGasOptimizations.sol
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.7; | |
error TooLowValue(); | |
// https://rinkeby.etherscan.io/tx/0x7cb53c1814638d217d8030d24141dd64f97fe557480e9b60b7bcd28af5d87014 | |
// Deploy Cost: 113,341 | |
contract Test { | |
// https://rinkeby.etherscan.io/tx/0x0a4ea95262492b62f83a81970a709c62291d5c575cf522dcb48b9e8e5b399006 | |
// Failed: 21,473 |
View FunWithStorage.sol
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.8.7; | |
contract FunWithStorage { | |
uint256 public cat; | |
bytes32 private constant DATA_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; | |
function getData() public view returns (uint256 data) { | |
bytes32 slot = DATA_SLOT; | |
assembly { | |
data := sload(slot) |
View EncodingFun.sol
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
// This example code is designed to quickly deploy an example contract using Remix. | |
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.8.0; | |
contract EncodingFun { | |
function encodeThenDecode(uint256 value) public pure returns (uint256) { | |
bytes memory encodedData = abi.encodePacked(value); | |
uint256 decodedData = abi.decode(encodedData, (uint256)); | |
return decodedData; | |
} |
View .deps...github...smartcontractkit...chainlink...evm-contracts...src...v0.4...Chainlink.sol
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.4.24; | |
import { CBOR as CBOR_Chainlink } from "./vendor/CBOR.sol"; | |
import { Buffer as Buffer_Chainlink } from "./vendor/Buffer.sol"; | |
/** | |
* @title Library for common Chainlink functions | |
* @dev Uses imported CBOR library for encoding to buffer | |
*/ | |
library Chainlink { |
View Weather.sol
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
// SPDX-License-Identifier: MIT | |
pragma solidity ^0.6.8; | |
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol"; | |
contract Weather is ChainlinkClient { | |
using Chainlink for Chainlink.Request; | |
bytes32 public avgTempJobId; | |
uint256 public avgTemp; |
View L2.sol
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.6.0; | |
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol"; | |
import "@chainlink/contracts/src/v0.6/interfaces/FlagsInterface.sol"; | |
contract OCRPriceConsumer { | |
// Identifier of the Sequencer offline flag on the Flags contract | |
address constant private FLAG_ARBITRUM_SEQ_OFFLINE = address(bytes20(bytes32(uint256(keccak256("chainlink.flags.arbitrum-seq-offline")) - 1))); | |
AggregatorV3Interface internal priceFeed; | |
FlagsInterface internal chainlinkFlags; |
NewerOlder