Skip to content

Instantly share code, notes, and snippets.

View mudgen's full-sized avatar

Nick Mudge mudgen

View GitHub Profile
did:3:kjzl6cwe1jw1497jm1ckqomr59zuprfmyjqqsk4mayxovtmgynx89x2ktfsvk69
pragma solidity ^0.8.17;
library LibPerson {
uint256 private constant INNER_STRUCT = 0;
struct Car {
string brand;
string model;
}
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.17;
struct Data {
uint a;
uint b;
}
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
import { LibDiamond } from "../libraries/LibDiamond.sol";
import { IDiamondCut } from "../interfaces/IDiamondCut.sol";
import { IERC165 } from "../interfaces/IERC165.sol";
import { IERC721 } from "../interfaces/IERC721.sol";
contract Diamond {
/**
*Submitted for verification at polygonscan.com on 2021-06-13
*/
pragma solidity 0.5.17;
/*
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
function doIt() external {
uint256 length = myArray.length; // state read
uint b;
for(uint256 i; i < length; i++) { // local reads
b++; // local write
}
mySum = b; // state write
// SPDX-License-Identifier: MIT
pragma solidity 0.8.11;
// Note: A facet is a contract used by a diamond.
// Note: This is a contrived example to show how to share internal functions between facets
// Note: It is not an accurate or complete implementation
// This design of sharing internal functions between facets works because remember the diamond proxy holds all the
// data and the facets read and write to the diamond proxy contract storage-- not to their own contract storage.
//SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
library MyLib {
function appStorage()
internal
pure
returns (AppStorage storage ds)
{
assembly {
//SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "./AppStorage.sol"
contract StakingFacet {
AppStorage internal s;
function myFacetFunction() external {
s.lastVar = s.firstVar + s.secondVar;
//SPDX-License-Identifier: MIT
pragma solidity =0.8.9;
import "./AppStorage.sol"
contract StakingFacet {
AppStorage internal s;
...