Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(rns-unified): merge from release/v0.2.0 #85

Merged
merged 64 commits into from
Oct 24, 2023
Merged
Show file tree
Hide file tree
Changes from 35 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
d030533
feat: implement Auction contract for RNS (#18)
Oct 12, 2023
e80c251
feat: add`RNSDomainPrice` contract (#19)
Oct 12, 2023
4492422
Resolve merge conflict/auction (#25)
Oct 12, 2023
f59b8b8
Merge branch 'release-testnet/v0.2.0' into feature/auction
ducthotran2010 Oct 12, 2023
113a81e
chore: resolve merge conflict 'feature/domain-price' into release-tes…
Oct 12, 2023
02f884f
Merge branch 'release-testnet/v0.2.0' into feature/domain-price
ducthotran2010 Oct 12, 2023
80d4738
chore: resolve confict
ducthotran2010 Oct 12, 2023
5bdcf13
chore: resolve merge conflict 'feature/domain-price' into release-tes…
ducthotran2010 Oct 12, 2023
0ddf631
feat: return tax price in `RNSDomainPrice` (#34)
TuDo1403 Oct 13, 2023
f257099
chore: merge 'release-testnet/v0.2.0' into feature/controller (#35)
TuDo1403 Oct 13, 2023
8425f06
feat: allow maintain reservation status for ids listed in auction con…
TuDo1403 Oct 13, 2023
b09eb66
feat: remove setter and event
TuDo1403 Oct 13, 2023
06d9c0b
Merge branch 'release-testnet/v0.2.0' into merge/release-testnet/v0.2…
TuDo1403 Oct 14, 2023
b924017
Merge branch 'release-testnet/v0.2.0' into merge/release-testnet/v0.2…
TuDo1403 Oct 14, 2023
7c997ba
fix: fix operator not assigned in RNSDomainPrice::initialize
TuDo1403 Oct 14, 2023
6dabda4
chore: pull latest from 'release/test-net/v0.2.0' to feature/domain-p…
TuDo1403 Oct 14, 2023
6ea2558
chore: pull latest from 'release/test-net/v0.2.0' to feature/auction …
TuDo1403 Oct 14, 2023
a752039
Merge branch 'feature/auction' into implement-feature/permanent-tax-f…
TuDo1403 Oct 14, 2023
fbfe1b4
Merge branch 'feature/domain-price' into fix/initialize/domain-price
TuDo1403 Oct 14, 2023
a5853cd
fix: operator not assigned in RNSDomainPrice.initialize (#50)
TuDo1403 Oct 14, 2023
9ff32b8
feat: maintain reserved status for ids listed in RNSAuction contract …
TuDo1403 Oct 14, 2023
adbf663
Merge branch 'release-testnet/v0.2.0' into merge/feature/auction/rele…
TuDo1403 Oct 14, 2023
6ad6f52
chore: pull lasest features from 'release-testnet/v0.2.0' into featur…
TuDo1403 Oct 14, 2023
53277d9
feat: add expiry check
TuDo1403 Oct 20, 2023
dd72b1e
Merge branch 'feature/domain-price' into implement-feature/domain-pri…
TuDo1403 Oct 20, 2023
02f6ab9
Merge branch 'feature/domain-price' into merge/release/v0.2.0-feature…
TuDo1403 Oct 20, 2023
84a0eed
chore(domain-price): merge from `release/v0.2.0` (#74)
ducthotran2010 Oct 20, 2023
9c77133
Merge branch 'feature/domain-price' into implement-feature/domain-pri…
TuDo1403 Oct 20, 2023
68d8d9a
feat: update logic & migration script
TuDo1403 Oct 21, 2023
f3f590d
Update src/RNSDomainPrice.sol
TuDo1403 Oct 21, 2023
ddd81c0
format: reorder function
TuDo1403 Oct 23, 2023
56aaf0d
feat(domain-price): implement `auction-domain-expiry` (#82)
TuDo1403 Oct 23, 2023
a94afeb
feat: update RNSUnified into 'release/v0.2.0' (#84)
TuDo1403 Oct 23, 2023
c97f0b1
Merge branch 'feature/domain-price' into merge/release/v0.2.0-feature…
TuDo1403 Oct 23, 2023
280acba
chore(domain-price): merge from `release/v0.2.0` (#86)
TuDo1403 Oct 23, 2023
dc0ee7b
chore: add ugrade artiface RNSUnified, RNSAuction, RNSDomainPrice
TuDo1403 Oct 23, 2023
f7ba28f
feature/enhnace pipeline for avoiding looping
huyngopt1994 Oct 23, 2023
a19a380
Fix syntax
huyngopt1994 Oct 23, 2023
c861a00
Update the correct branch name
huyngopt1994 Oct 23, 2023
e128e70
Update .github/workflows/create-PR-release.yml
ducthotran2010 Oct 23, 2023
fb37816
feat(enhance): Pipeline for avoiding hardcode (#88)
ducthotran2010 Oct 23, 2023
3499af5
chore: add upgrade artiface RNSUnified, RNSAuction, RNSDomainPrice (#87)
ducthotran2010 Oct 23, 2023
aab5592
chore(`feature/ci`): merge from `release/v0.2.0` (#78)
ducthotran2010 Oct 23, 2023
70322e2
chore: update PR title
ducthotran2010 Oct 23, 2023
5b37dd5
chore(ci): update PR title (#92)
ducthotran2010 Oct 23, 2023
aaad2cb
chore(`domain-price`): merge from `release/v0.2.0` (#91)
TuDo1403 Oct 24, 2023
c0f54e8
feat: Add tax and limit renewal duration for auction domains (#94)
TuDo1403 Oct 24, 2023
f3df240
Merge branch 'feature/auction' into merge/release/v0.2.0-feature/auction
TuDo1403 Oct 24, 2023
98c17d9
chore(`auction`): merge from `release/v0.2.0` (#77)
TuDo1403 Oct 24, 2023
345a490
feat: forbid contract bidder
TuDo1403 Oct 24, 2023
b23f0c9
feat: update migration script
TuDo1403 Oct 24, 2023
d596a17
format: rename script
TuDo1403 Oct 24, 2023
9ecc86f
format: rename outdated error
TuDo1403 Oct 24, 2023
5a3867b
feat(auction): implement `eoa-bidder` (#96)
TuDo1403 Oct 24, 2023
929b660
feat: add upload-sig script
TuDo1403 Oct 24, 2023
ebb4170
feat: add script to upload event & error & fn selectors (#98)
ducthotran2010 Oct 24, 2023
f1d8a86
feat: forbid contract to place bid in `RNSAuction` (#97)
ducthotran2010 Oct 24, 2023
09726ff
feat: add OVERRIDER_ROLE and migration scripts
TuDo1403 Oct 24, 2023
b58214e
Update src/RNSDomainPrice.sol
ducthotran2010 Oct 24, 2023
f35ddbd
feat: use overrider role for bulkSetDomainPrice
TuDo1403 Oct 24, 2023
b3e6069
feat(domain-price): implement `overrider-role` (#100)
TuDo1403 Oct 24, 2023
1e40778
Merge branch 'feature/domain-price' into merge/release/v0.2.0-feature…
TuDo1403 Oct 24, 2023
422f5e5
chore(`domain-price`): merge from `release/v0.2.0` (#95)
TuDo1403 Oct 24, 2023
35340bf
feat: add overrider role to set & override name price, renewal fee (#…
TuDo1403 Oct 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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/render-template@v1.4
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/render-template@v1.4
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/render-template@v1.4
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/render-template@v1.4
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/render-template@v1.4
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/render-template@v1.4
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: 6 additions & 5 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 @@ -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
15 changes: 13 additions & 2 deletions src/RNSDomainPrice.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import { Initializable } from "@openzeppelin/contracts/proxy/utils/Initializable
import { AccessControlEnumerable } from "@openzeppelin/contracts/access/AccessControlEnumerable.sol";
import { Math } from "@openzeppelin/contracts/utils/math/Math.sol";
import { IPyth, PythStructs } from "@pythnetwork/IPyth.sol";
import { INSUnified } from "./interfaces/INSUnified.sol";
import { INSAuction } from "./interfaces/INSAuction.sol";
import { INSDomainPrice } from "./interfaces/INSDomainPrice.sol";
import { PeriodScaler, LibPeriodScaler, Math } from "./libraries/math/PeriodScalingUtils.sol";
import { TimestampWrapper } from "./libraries/TimestampWrapperUtils.sol";
import { LibSafeRange } from "./libraries/math/LibSafeRange.sol";
import { LibString } from "./libraries/LibString.sol";
import { LibRNSDomain } from "./libraries/LibRNSDomain.sol";
import { PythConverter } from "./libraries/pyth/PythConverter.sol";
Expand Down Expand Up @@ -253,8 +255,17 @@ contract RNSDomainPrice is Initializable, AccessControlEnumerable, INSDomainPric
} else {
uint256 renewalFeeByLength = _rnFee[Math.min(nameLen, _rnfMaxLength)];
basePrice.usd = duration * renewalFeeByLength;
// tax is added of name is reserved for auction
if (_auction.reserved(LibRNSDomain.toId(LibRNSDomain.RON_ID, label))) {
uint256 id = LibRNSDomain.toId(LibRNSDomain.RON_ID, label);
INSAuction auction = _auction;
if (auction.reserved(id)) {
INSUnified rns = auction.getRNSUnified();
uint256 expiry = LibSafeRange.addWithUpperbound(rns.getRecord(id).mut.expiry, duration, type(uint64).max);
(INSAuction.DomainAuction memory domainAuction,) = auction.getAuction(id);
uint256 claimedAt = domainAuction.bid.claimedAt;
if (claimedAt != 0 && expiry - claimedAt > auction.MAX_AUCTION_DOMAIN_EXPIRY()) {
revert ExceedAuctionDomainExpiry();
}
// Tax is added to the name reserved for the auction
tax.usd = Math.mulDiv(_taxRatio, _getDomainPrice(lbHash), MAX_PERCENTAGE);
}
}
Expand Down
9 changes: 7 additions & 2 deletions src/interfaces/INSAuction.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface INSAuction {
address payable bidder;
uint256 price;
uint256 timestamp;
bool claimed;
uint256 claimedAt;
}

struct DomainAuction {
Expand Down Expand Up @@ -54,6 +54,11 @@ interface INSAuction {
*/
function MAX_EXPIRY() external pure returns (uint64);

/**
* @dev The maximum expiry duration of a domain after transferring to bidder.
*/
function MAX_AUCTION_DOMAIN_EXPIRY() external pure returns (uint64);

/**
* @dev Returns the operator role.
*/
Expand Down Expand Up @@ -161,7 +166,7 @@ interface INSAuction {
*
* @param ids The namehash id of domain name. Eg, namehash('foo.ron') for 'foo.ron'
*/
function bulkClaimBidNames(uint256[] calldata ids) external returns (bool[] memory claimeds);
function bulkClaimBidNames(uint256[] calldata ids) external returns (uint256[] memory claimedAts);

/**
* @dev Returns the treasury.
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/INSDomainPrice.sol
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { IPyth } from "@pythnetwork/IPyth.sol";
interface INSDomainPrice {
error InvalidArrayLength();
error RenewalFeeIsNotOverriden();
error ExceedAuctionDomainExpiry();

struct RenewalFee {
uint256 labelLength;
Expand Down
Loading