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.11; | |
// https://ethereum.org/en/developers/docs/smart-contracts/ | |
contract VendingMachine { | |
// Declare state variables of the contract | |
address public owner; | |
mapping (address => uint) public cupcakeBalances; | |
// When 'VendingMachine' contract is deployed: | |
// 1. set the deploying address as the owner of the contract |
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.7.0 <0.9.0; | |
/// @title Simple DAO smart contract. | |
contract simpleDAO { | |
// This simple DAO smart contract sends ether to the predefined address only if | |
// the majority of the members agree to send ether to the predefined address. | |
// If the majority decides not to send ether, the members who deposited ether | |
// are able to withdraw the ether they deposited. | |
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
function vote(uint proposal) public { | |
Voter storage sender = voters[msg.sender]; | |
require(sender.weight != 0, "Has no right to vote"); | |
require(!sender.voted, "Already voted."); | |
sender.voted = true; | |
sender.vote = proposal; | |
proposals[proposal].voteCount += sender.weight; | |
} | |
// winningProposal must be executed before EndVote |
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; | |
import "https://github.com/0xcert/ethereum-erc721/src/contracts/tokens/nf-token-metadata.sol"; | |
import "https://github.com/0xcert/ethereum-erc721/src/contracts/ownership/ownable.sol"; | |
contract newNFT is NFTokenMetadata, Ownable { | |
constructor() { | |
nftName = "artwork NFT"; |
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
#!/bin/bash | |
xrandr --output DP-1 --scale 1.5x1.5 | |
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.7.0 <0.9.0; | |
contract natural_log { | |
function log2(uint x) public pure returns (uint){ | |
uint y; | |
assembly { | |
let arg := x | |
x := sub(x,1) |
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; | |
import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; | |
contract DefintionHackathonPrizeMoney { | |
//@dev address Owner => address token => uint balance of token | |
mapping(address => mapping (address => uint)) public prizeMoney; |
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
def GLSpi(x): | |
odd = [] | |
pi_div_4 = [] | |
for i in range(x): | |
if i % 2 == 1: | |
odd.append(i) | |
for i in range(len(odd)): |
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: BSD-3-Clause | |
pragma solidity ^0.8.19; | |
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; | |
import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; | |
contract Token is ERC20 { | |
uint constant _initial_supply = 100 * 1e18 * 1e6; // 100 million |
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.22; | |
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol"; | |
contract DelegatedSignature { | |
// gameAddress => uint16 moves | |
mapping(address => uint16[]) public userData; // on chain data |
OlderNewer