Skip to content

Instantly share code, notes, and snippets.

View bertil291utn's full-sized avatar
📺
WFH

Bertil Tandayamo bertil291utn

📺
WFH
View GitHub Profile
@bertil291utn
bertil291utn / contracts...SimpleStorage.sol
Created June 11, 2022 18:20
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.3;
contract SimpleStorage{
uint256 age;
struct Humans{
uint256 age;
string name;
}
@bertil291utn
bertil291utn / contracts...StorageFactory.sol
Created June 11, 2022 18:21
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
pragma solidity ^0.8.3;
import "./SimpleStorage.sol";
contract StorageFactory is SimpleStorage{
SimpleStorage [] public SSArray;
function createSSContract()public{
SimpleStorage genSS=new SimpleStorage();
SSArray.push(genSS);
}
@bertil291utn
bertil291utn / contracts...ExtraStorage.sol
Last active June 11, 2022 18:22
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: GPL-3.0
//REF: https://github.com/spo0ds/Journey-to-become-a-Blockchain-Engineer
pragma solidity ^0.8.3;
import "./SimpleStorage.sol";
contract ExtraStorage is SimpleStorage{
function incrementAge(uint256 _age) public override{
age=_age+1;
}
}
@bertil291utn
bertil291utn / contracts...FundMe.sol
Last active June 22, 2022 03:40
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifer: MIT
pragma solidity ^0.8.4;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "./PriceConverter.sol";
error noOwner();
contract FundMe{
@bertil291utn
bertil291utn / contracts...PriceConverter.sol
Created June 22, 2022 03:37
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.12+commit.f00d7308.js&optimize=false&runs=200&gist=
// SPDX-License-Identifer: MIT
pragma solidity ^0.8.3;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
library PriceConverter{
@bertil291utn
bertil291utn / contracts...Lottery.sol
Last active July 16, 2022 18:16
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.3;
import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol";
import "@chainlink/contracts/src/v0.8/VRFConsumerBase.sol";
import "@openzeppelin/contracts/access/Ownable.sol";
import "hardhat/console.sol";
//TODO: test with hardhat js
@bertil291utn
bertil291utn / contracts...Attacker.sol
Created August 15, 2022 16:51
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.10+commit.fc410830.js&optimize=false&runs=200&gist=
pragma solidity 0.8.10;
import "./Challenge.sol";
contract Attack is Challenge {
Challenge public challenge;
address[] public _winners;
constructor(address _challengeAddress) {
challenge = Challenge(_challengeAddress);
// _winners=challenge.winners;
@bertil291utn
bertil291utn / contracts...Challenge.sol
Created August 15, 2022 16:52
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.10+commit.fc410830.js&optimize=false&runs=200&gist=
pragma solidity 0.8.10;
// The goal of this challenge is to be able to sign offchain a message
// with an address stored in winners.
contract Challenge{
address[] public winners;
bool lock;
function exploit_me(address winner) public{
@bertil291utn
bertil291utn / contracts...ExampleRevert.sol
Last active September 3, 2022 18:37
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
pragma solidity 0.8.7;
//rinkeby 0x2E772a6488A1592e6eB9d84CfBb7417AF6a039fd
contract ExampleRevert{
uint256 private init;
function release_r()public view{
require(init>100,"Revert error message from SC");
}
function release_w()public{
require(init>100,"Revert error message from SC");
init=1;
@bertil291utn
bertil291utn / contract-789f444d97.sol
Last active November 8, 2022 23:02
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.7+commit.e28d00a7.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.4;
import "@openzeppelin/contracts@4.7.3/token/ERC20/ERC20.sol";
contract BertilTokens is ERC20 {
uint256 internal fullAmountTokens = 10000 * 10**decimals();
constructor(address _claimableToken,address _stakingAddress) ERC20("BertilTokens", "BATL") {
_mint(_claimableToken, fullAmountTokens);