Skip to content

Commit

Permalink
just use github runners, add clear base fee option (#750)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xBigBoss authored Oct 7, 2024
1 parent 644b9fc commit bcba890
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 6 deletions.
31 changes: 26 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,21 @@ jobs:
YARN_ENABLE_HARDENED_MODE: 0

steps:
- name: Install Tilt
id: tilt
shell: bash
run: curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash
- name: Add hosts to /etc/hosts
run: |
sudo su
if grep -q "host.docker.internal" /etc/hosts; then
echo "Hosts file already contains host.docker.internal"
else
echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts
fi
- uses: actions/checkout@v4
with:
submodules: recursive
# No idea how homebrew bundle broke with tilt depending on python so installing manually
- name: Install Tilt
uses: ./.github/actions/install-tilt
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
Expand Down Expand Up @@ -99,12 +108,24 @@ jobs:
permissions:
pull-requests: write

timeout-minutes: 40

steps:
- name: Install Tilt
id: tilt
shell: bash
run: curl -fsSL https://raw.githubusercontent.com/tilt-dev/tilt/master/scripts/install.sh | bash
- name: Add hosts to /etc/hosts
run: |
sudo su
if grep -q "host.docker.internal" /etc/hosts; then
echo "Hosts file already contains host.docker.internal"
else
echo "127.0.0.1 host.docker.internal" | sudo tee -a /etc/hosts
fi
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install Tilt
uses: ./.github/actions/install-tilt
- name: Set up Homebrew
id: set-up-homebrew
uses: Homebrew/actions/setup-homebrew@master
Expand Down
17 changes: 16 additions & 1 deletion packages/contracts/script/UpdateTokenPaymasterConfig.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import "../src/TokenPaymaster.sol";

// solhint-disable no-console
contract UpdateTokenPaymasterConfigScript is Script, Helper {
uint256 private constant PRICE_DENOM = 1e26;
uint40 private constant BASE_FEE_DEFAULT = 5e4; // ¢5
Expand All @@ -28,13 +29,27 @@ contract UpdateTokenPaymasterConfigScript is Script, Helper {
uint40 _baseFee,
address _rewardsPool
) = paymaster.tokenPaymasterConfig();

console2.log("current priceMarkup", _priceMarkup);
console2.log("current minEntryPointBalance", _minEntryPointBalance);
console2.log("current refundPostopCost", _refundPostopCost);
console2.log("current priceMaxAge", _priceMaxAge);
console2.log("current baseFee", _baseFee);
console2.log("current rewardsPool", _rewardsPool);

uint256 priceMarkup = vm.envOr("PRICE_MARKUP", _priceMarkup);
uint128 minEntryPointBalance = uint128(vm.envOr("MIN_ENTRY_POINT_BALANCE", _minEntryPointBalance));
uint48 refundPostopCost = uint48(vm.envOr("REFUND_POSTOP_COST", _refundPostopCost));
uint48 priceMaxAge = uint48(vm.envOr("PRICE_MAX_AGE", _priceMaxAge));
uint40 baseFee = uint40(vm.envOr("BASE_FEE", _baseFee));
bool baseFeeClear = vm.envOr("BASE_FEE_CLEAR", false);
address rewardsPool = vm.envOr("REWARDS_POOL", _rewardsPool);

if (baseFeeClear) {
console2.log("Clearing baseFee", baseFeeClear);
baseFee = 0;
}

require(
priceMaxAge != _priceMaxAge || refundPostopCost != _refundPostopCost
|| minEntryPointBalance != _minEntryPointBalance || priceMarkup != _priceMarkup || baseFee != _baseFee
Expand All @@ -45,7 +60,7 @@ contract UpdateTokenPaymasterConfigScript is Script, Helper {
require(refundPostopCost > 0, "REFUND_POSTOP_COST env variable not set");
require(minEntryPointBalance > 0, "MIN_ENTRY_POINT_BALANCE env variable not set");
require(priceMarkup > 0, "PRICE_MARKUP env variable not set");
require(baseFee > 0, "BASE_FEE env variable not set");
require(baseFee > 0 || (baseFee == 0 && baseFeeClear), "BASE_FEE env variable not set");

vm.startBroadcast();
TokenPaymasterConfig memory tpc = TokenPaymasterConfig({
Expand Down

0 comments on commit bcba890

Please sign in to comment.