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
ORACLE_ABI = """[{"inputs":[{"internalType":"address","name":"_aggregator","type":"address"},{"internalType":"address","name":"_accessController","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"int256","name":"current","type":"int256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updatedAt","type":"uint256"}],"name":"AnswerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":true,"internalType":"address","name":"startedBy","type":"address"},{"indexed":false,"internalType":"uint256","name":"startedAt","type":"uint256"}],"name":"NewRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"}],"name":"OwnershipTransferRequested"," |
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.21; | |
import "forge-std/Test.sol"; | |
import "forge-std/console.sol"; | |
import {BeaconProxy} from "@openzeppelin/contracts/proxy/beacon/BeaconProxy.sol"; | |
import {Initializable} from "@openzeppelin/contracts/proxy/utils/Initializable.sol"; | |
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; | |
import {UpgradeableBeacon} from "@openzeppelin/contracts/proxy/beacon/UpgradeableBeacon.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
function testReadPrivateVars() external { | |
for(uint i=0; i < 100; i++){ | |
console.logBytes32(vm.load(address, bytes32(i))); | |
} | |
} |
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.13; | |
contract ChainlinkTCAPAggregatorV3 { | |
struct RoundData { | |
uint80 roundId; | |
uint80 answeredInRound; | |
int256 answer; | |
uint256 startedAt; | |
uint256 updatedAt; |
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
from collections import namedtuple | |
from rebate_program.celery import app # get the celery app object from your project | |
from redbeat.schedulers import RedBeatScheduler, acquire_distributed_beat_lock | |
beat = RedBeatScheduler(app) | |
Sender = namedtuple('sender', ['scheduler']) | |
sender = Sender(beat) | |
acquire_distributed_beat_lock(sender) | |
print(beat.schedule) |
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: UNLICENSED | |
pragma solidity ^0.7.5; | |
import "forge-std/Script.sol"; | |
import "forge-std/console.sol"; | |
contract Greeter { | |
string greeting; | |
constructor(string memory _greeting) { |
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.5; | |
import "forge-std/Test.sol"; | |
contract Greeter { | |
string greeting; | |
constructor(string memory _greeting) { |
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.5; | |
import "forge-std/Test.sol"; | |
import "forge-std/console.sol"; | |
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; | |
import { TransparentUpgradeableProxy } from "@openzeppelin/contracts/proxy/TransparentUpgradeableProxy.sol"; | |
contract Greeter is Ownable { |
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 repeating_digit(num: int) -> int: | |
""" | |
code inspired by | |
The Reciprocals of Primes - Numberphile | |
on youtube: https://www.youtube.com/watch?v=DmfxIhmGPP4&ab_channel=Numberphile | |
Parameter | |
num: a prime number | |
returns: The number of repeating digits of reciprocal of a prime number |
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 ones(n): | |
return sum(10 ** i for i in range(n)) | |
def print_pattern(n): | |
for i in range(1, n+1): | |
num = ones(i) | |
print(" " * (2*(n-i)), end='') | |
print(f"{num} x {num} = {num * num}", end="\n\n") |
NewerOlder