Skip to content

Commit

Permalink
chore(rns-unified): merge from release/v0.2.0 (#85)
Browse files Browse the repository at this point in the history
  • Loading branch information
TuDo1403 authored Oct 24, 2023
2 parents 49fa4fd + 35340bf commit 6a59401
Show file tree
Hide file tree
Showing 18 changed files with 44,070 additions and 585 deletions.
206 changes: 9 additions & 197 deletions .github/workflows/create-PR-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@ env:
HEAD_BRANCH: ${{ github.head_ref || github.ref_name }}

jobs:
mergeRelease2FeatureRnsUnified:
mergeRelease2FeatureRepo:
runs-on: ubuntu-latest
strategy:
matrix:
branch_name: [feature/rns-unified, feature/controller, feature/domain-price, feature/auction, feature/public-resolver, feature/ci, feature/reverse-registrar]
steps:
- name: Set env
run: |
echo "PR_BRANCH=merge/${HEAD_BRANCH}-feature/rns-unified" >> $GITHUB_ENV
echo "PR_BRANCH=merge/${HEAD_BRANCH}-${{matrix.branch_name}}" >> $GITHUB_ENV
echo "FEATURE_NAME=$(echo ${{matrix.branch_name}} | cut -d'/' -f2)" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: feature/rns-unified
ref: ${{matrix.branch_name}}
- name: Reset promotion branch
run: |
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH}
Expand All @@ -34,205 +38,13 @@ jobs:
template: .github/template/create-pull-request.md
vars: |
fromBranch: ${{env.HEAD_BRANCH}}
toBranch: feature/rns-unified
toBranch: ${{matrix.branch_name}}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
labels: automated PR
delete-branch: true
title: 'chore(rns-unified): merge from `${{env.HEAD_BRANCH}}`'
body: ${{ steps.template.outputs.result }}
branch: ${{env.PR_BRANCH}}

mergeRelease2FeatureController:
runs-on: ubuntu-latest
steps:
- name: Set env
run: |
echo "PR_BRANCH=merge/${HEAD_BRANCH}-feature/controller" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: feature/controller
- name: Reset promotion branch
run: |
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH}
git reset --hard ${HEAD_BRANCH}
- name: Render template
id: template
uses: chuhlomin/[email protected]
with:
template: .github/template/create-pull-request.md
vars: |
fromBranch: ${{env.HEAD_BRANCH}}
toBranch: feature/controller
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
labels: automated PR
delete-branch: true
title: 'chore(controller): merge from `${{env.HEAD_BRANCH}}`'
body: ${{ steps.template.outputs.result }}
branch: ${{env.PR_BRANCH}}

mergeRelease2FeatureDomainPrice:
runs-on: ubuntu-latest
steps:
- name: Set env
run: |
echo "PR_BRANCH=merge/${HEAD_BRANCH}-feature/domain-price" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: feature/domain-price
- name: Reset promotion branch
run: |
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH}
git reset --hard ${HEAD_BRANCH}
- name: Render template
id: template
uses: chuhlomin/[email protected]
with:
template: .github/template/create-pull-request.md
vars: |
fromBranch: ${{env.HEAD_BRANCH}}
toBranch: feature/domain-price
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
labels: automated PR
delete-branch: true
title: 'chore(domain-price): merge from `${{env.HEAD_BRANCH}}`'
body: ${{ steps.template.outputs.result }}
branch: ${{env.PR_BRANCH}}

mergeRelease2FeatureAuction:
runs-on: ubuntu-latest
steps:
- name: Set env
run: |
echo "PR_BRANCH=merge/${HEAD_BRANCH}-feature/auction" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: feature/auction
- name: Reset promotion branch
run: |
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH}
git reset --hard ${HEAD_BRANCH}
- name: Render template
id: template
uses: chuhlomin/[email protected]
with:
template: .github/template/create-pull-request.md
vars: |
fromBranch: ${{env.HEAD_BRANCH}}
toBranch: feature/auction
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
labels: automated PR
delete-branch: true
title: 'chore(auction): merge from `${{env.HEAD_BRANCH}}`'
body: ${{ steps.template.outputs.result }}
branch: ${{env.PR_BRANCH}}

mergeRelease2FeaturePublicResolver:
runs-on: ubuntu-latest
steps:
- name: Set env
run: |
echo "PR_BRANCH=merge/${HEAD_BRANCH}-feature/public-resolver" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: feature/public-resolver
- name: Reset promotion branch
run: |
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH}
git reset --hard ${HEAD_BRANCH}
- name: Render template
id: template
uses: chuhlomin/[email protected]
with:
template: .github/template/create-pull-request.md
vars: |
fromBranch: ${{env.HEAD_BRANCH}}
toBranch: feature/public-resolver
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
labels: automated PR
delete-branch: true
title: 'chore(public-resolver): merge from `${{env.HEAD_BRANCH}}`'
body: ${{ steps.template.outputs.result }}
branch: ${{env.PR_BRANCH}}

mergeRelease2FeatureCI:
runs-on: ubuntu-latest
steps:
- name: Set env
run: |
echo "PR_BRANCH=merge/${HEAD_BRANCH}-feature/ci" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: feature/ci
- name: Reset promotion branch
run: |
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH}
git reset --hard ${HEAD_BRANCH}
- name: Render template
id: template
uses: chuhlomin/[email protected]
with:
template: .github/template/create-pull-request.md
vars: |
fromBranch: ${{env.HEAD_BRANCH}}
toBranch: feature/ci
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
labels: automated PR
delete-branch: true
title: 'chore(ci): merge from `${{env.HEAD_BRANCH}}`'
body: ${{ steps.template.outputs.result }}
branch: ${{env.PR_BRANCH}}

mergeRelease2FeatureReverseRegistrar:
runs-on: ubuntu-latest
steps:
- name: Set env
run: |
echo "PR_BRANCH=merge/${HEAD_BRANCH}-feature/reverse-registrar" >> $GITHUB_ENV
- uses: actions/checkout@v3
with:
ref: feature/reverse-registrar
- name: Reset promotion branch
run: |
git fetch origin ${HEAD_BRANCH}:${HEAD_BRANCH}
git reset --hard ${HEAD_BRANCH}
- name: Render template
id: template
uses: chuhlomin/[email protected]
with:
template: .github/template/create-pull-request.md
vars: |
fromBranch: ${{env.HEAD_BRANCH}}
toBranch: feature/reverse-registrar
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
labels: automated PR
delete-branch: true
title: 'chore(reverse-registrar): merge from `${{env.HEAD_BRANCH}}`'
title: 'chore(`${{env.FEATURE_NAME}}`): merge from `${{env.HEAD_BRANCH}}`'
body: ${{ steps.template.outputs.result }}
branch: ${{env.PR_BRANCH}}
52 changes: 52 additions & 0 deletions broadcast/20231020_RNSUpgrade.s.sol/2021/run-1697784642.json

Large diffs are not rendered by default.

111 changes: 111 additions & 0 deletions broadcast/20231020_RNSUpgrade.s.sol/2021/run-1697784648.json

Large diffs are not rendered by default.

111 changes: 111 additions & 0 deletions broadcast/20231020_RNSUpgrade.s.sol/2021/run-latest.json

Large diffs are not rendered by default.

12,802 changes: 12,541 additions & 261 deletions deployments/ronin-testnet/RNSAuctionLogic.json

Large diffs are not rendered by default.

14,657 changes: 14,605 additions & 52 deletions deployments/ronin-testnet/RNSDomainPriceLogic.json

Large diffs are not rendered by default.

16,528 changes: 16,467 additions & 61 deletions deployments/ronin-testnet/RNSUnifiedLogic.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { RNSDeploy } from "script/RNSDeploy.s.sol";

contract Migration__20231021_UpgradeDomainPriceAndAuction is RNSDeploy {
function run() public trySetUp {
_upgradeProxy(ContractKey.RNSAuction, EMPTY_ARGS);
_upgradeProxy(ContractKey.RNSDomainPrice, EMPTY_ARGS);
}
}
11 changes: 11 additions & 0 deletions script/20231024-upgrade-auction/20231024_UpgradeAuction.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { RNSDeploy } from "script/RNSDeploy.s.sol";

contract Migration__20231024_UpgradeAuction is RNSDeploy {
function run() public trySetUp {
_upgradeProxy(ContractKey.RNSAuction, EMPTY_ARGS);
}
}
17 changes: 17 additions & 0 deletions script/20231024-upgrade-domain-price/20231024_Config.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { Network, RNSDeploy } from "script/RNSDeploy.s.sol";

abstract contract Config__20231024 is RNSDeploy {
function _buildMigrationConfig() internal view virtual override returns (Config memory config) {
config = super._buildMigrationConfig();
if (_network == Network.RoninTestnet) {
config.overrider = config.operator;
} else if (_network == Network.RoninMainnet) {
revert("Missing config");
} else {
revert("Missing config");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import { console2 } from "forge-std/console2.sol";
import { ContractKey } from "foundry-deployment-kit/configs/ContractConfig.sol";
import { RNSDomainPrice } from "@rns-contracts/RNSDomainPrice.sol";
import { Config__20231024 } from "./20231024_Config.s.sol";

contract Migration__20231024_UpgradeDomainPrice is Config__20231024 {
function run() public trySetUp {
Config memory config = getConfig();
_upgradeProxy(ContractKey.RNSDomainPrice, EMPTY_ARGS);

console2.log("operator", config.operator);
console2.log("overrider", config.overrider);

RNSDomainPrice domainPrice = RNSDomainPrice(_config.getAddressFromCurrentNetwork(ContractKey.RNSDomainPrice));
address admin = domainPrice.getRoleMember(0x00, 0);
bytes32 overriderRole = domainPrice.OVERRIDER_ROLE();
vm.broadcast(admin);
domainPrice.grantRole(overriderRole, config.overrider);
}
}
2 changes: 1 addition & 1 deletion script/Debug.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ contract Debug is RNSDeploy {

function debug(uint256 forkBlock, address from, address to, uint256 value, bytes calldata callData) external {
if (forkBlock != 0) {
vm.rollFork(forkBlock);
vm.rollFork(forkBlock);
}
vm.prank(from);
(bool success, bytes memory returnOrRevertData) = to.call{ value: value }(callData);
Expand Down
1 change: 1 addition & 0 deletions script/RNSDeploy.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ abstract contract RNSDeploy is BaseDeploy {
IPyth pyth;
address admin;
address pauser;
address overrider;
address controller;
uint8 minWord;
uint8 maxWord;
Expand Down
13 changes: 7 additions & 6 deletions src/RNSAuction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
/// @inheritdoc INSAuction
uint64 public constant DOMAIN_EXPIRY_DURATION = 365 days;
/// @inheritdoc INSAuction
uint64 public constant MAX_AUCTION_DOMAIN_EXPIRY = 365 days * 3;
/// @inheritdoc INSAuction
bytes32 public constant OPERATOR_ROLE = keccak256("OPERATOR_ROLE");

/// @dev Gap for upgradeability.
uint256[50] private ____gap;

/// @dev The RNSUnified contract.
INSUnified internal _rnsUnified;
/// @dev Mapping from auction Id => event range
Expand Down Expand Up @@ -190,7 +191,7 @@ contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
if (msg.value < beatPrice) revert InsufficientAmount();
address payable bidder = payable(_msgSender());
// check whether the bidder can receive RON
if (!RONTransferHelper.send(bidder, 0)) revert BidderCannotReceiveRON();
if (bidder != tx.origin) revert ContractBidderIsForbidden();
address payable prvBidder = auction.bid.bidder;
uint256 prvPrice = auction.bid.price;

Expand All @@ -207,13 +208,13 @@ contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
/**
* @inheritdoc INSAuction
*/
function bulkClaimBidNames(uint256[] calldata ids) external returns (bool[] memory claimeds) {
function bulkClaimBidNames(uint256[] calldata ids) external returns (uint256[] memory claimedAts) {
uint256 id;
uint256 accumulatedRON;
EventRange memory range;
DomainAuction memory auction;
uint256 length = ids.length;
claimeds = new bool[](length);
claimedAts = new uint256[](length);
INSUnified rnsUnified = _rnsUnified;
uint64 expiry = uint64(block.timestamp.addWithUpperbound(DOMAIN_EXPIRY_DURATION, MAX_EXPIRY));

Expand All @@ -222,15 +223,15 @@ contract RNSAuction is Initializable, AccessControlEnumerable, INSAuction {
auction = _domainAuction[id];
range = _auctionRange[auction.auctionId];

if (!auction.bid.claimed) {
if (auction.bid.claimedAt == 0) {
if (!range.isEnded()) revert NotYetEnded();
if (auction.bid.timestamp == 0) revert NoOneBidded();

accumulatedRON += auction.bid.price;
rnsUnified.setExpiry(id, expiry);
rnsUnified.transferFrom(address(this), auction.bid.bidder, id);

_domainAuction[id].bid.claimed = claimeds[i] = true;
_domainAuction[id].bid.claimedAt = claimedAts[i] = block.timestamp;
}

unchecked {
Expand Down
Loading

0 comments on commit 6a59401

Please sign in to comment.