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

feat: update core contract & deploy script #226

Open
wants to merge 26 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
27 changes: 26 additions & 1 deletion .github/workflows/solidity-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
run: pnpm install

- name: Compile
run: pnpm run compile:upgradeable
run: pnpm run compile:modularized

- name: Publish
run: pnpm --filter=./typechain publish --no-git-checks
Expand Down Expand Up @@ -97,3 +97,28 @@ jobs:
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
publish-contracts-modularized:
runs-on: ubuntu-latest
defaults:
run:
working-directory: contracts-modularized
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Install pnpm
uses: pnpm/[email protected]
with:
version: 7

- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 18.x
registry-url: https://npm.pkg.github.com/
cache: 'pnpm'

- name: Publish
run: pnpm publish --no-git-checks
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
4 changes: 4 additions & 0 deletions .versionrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
{
"filename": "contracts-upgradeable/package.json",
"type": "json"
},
{
"filename": "contracts-modularized/package.json",
"type": "json"
}
]
}
74 changes: 74 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,80 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.3.2-beta.2](https://github.com/desoul-labs/soulhub-contracts/compare/v0.3.2-beta.1...v0.3.2-beta.2) (2023-05-17)


### Features

* update core contract ([1c31f16](https://github.com/desoul-labs/soulhub-contracts/commit/1c31f16d3793ef1aa1d5876036124f68df140fbe))

### [0.3.2-beta.1](https://github.com/desoul-labs/soulhub-contracts/compare/v0.3.2...v0.3.2-beta.1) (2023-05-15)

### Features

- add ERC5727SlotSettable ([fd1b945](https://github.com/desoul-labs/soulhub-contracts/commit/fd1b945e8619ede4a2ae37e4b4e508988926829e))

### Bug Fixes

- fix deploy script ([e2ac68d](https://github.com/desoul-labs/soulhub-contracts/commit/e2ac68d7032bf4ca8bcde186dc57532bd320b38e))

### [0.3.2](https://github.com/desoul-labs/soulhub-contracts/compare/v0.3.1...v0.3.2) (2023-05-15)

### Bug Fixes

- fix init contract ([ee8694b](https://github.com/desoul-labs/soulhub-contracts/commit/ee8694b0b2ced6b2ddd837a9fe8229454e1eb5ab))

### [0.3.1](https://github.com/desoul-labs/soulhub-contracts/compare/v0.3.0...v0.3.1) (2023-05-15)

## [0.3.0](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.0-alpha.1...v0.3.0) (2023-05-15)

### Features

- add modularized contract ([#223](https://github.com/desoul-labs/soulhub-contracts/issues/223)) ([d5bc3d1](https://github.com/desoul-labs/soulhub-contracts/commit/d5bc3d160eef785ed771beb3ec1f1d4832f0187b))
- add unit test & fix bugs ([#220](https://github.com/desoul-labs/soulhub-contracts/issues/220)) ([85ed7af](https://github.com/desoul-labs/soulhub-contracts/commit/85ed7af800df20d2d57b886cb8a72ee7b4aed7ff))
- update soulhub contract ([dd42270](https://github.com/desoul-labs/soulhub-contracts/commit/dd422701f3c5b3803bbe56c9efa5487805d60ce1))

### Bug Fixes

- fix typechain package ([2e519e7](https://github.com/desoul-labs/soulhub-contracts/commit/2e519e79a49ff8844543f41b45ddb81e432954ab))
- merge dev ([06aeebf](https://github.com/desoul-labs/soulhub-contracts/commit/06aeebfe2a1a709504f3d901a30b6b47f3aa9a5e))
- package.json ([f74a398](https://github.com/desoul-labs/soulhub-contracts/commit/f74a39821a87fc65a3bb9163dd30884139086268))
- remove files ([487ba64](https://github.com/desoul-labs/soulhub-contracts/commit/487ba64686bb1f3ec81acf1899545c08ed158686))

## [0.3.0](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.0-alpha.1...v0.3.0) (2023-05-14)

### Features

- add modularized contract ([#223](https://github.com/desoul-labs/soulhub-contracts/issues/223)) ([d5bc3d1](https://github.com/desoul-labs/soulhub-contracts/commit/d5bc3d160eef785ed771beb3ec1f1d4832f0187b))
- add unit test & fix bugs ([#220](https://github.com/desoul-labs/soulhub-contracts/issues/220)) ([85ed7af](https://github.com/desoul-labs/soulhub-contracts/commit/85ed7af800df20d2d57b886cb8a72ee7b4aed7ff))
- update soulhub contract ([dd42270](https://github.com/desoul-labs/soulhub-contracts/commit/dd422701f3c5b3803bbe56c9efa5487805d60ce1))

### Bug Fixes

- merge dev ([06aeebf](https://github.com/desoul-labs/soulhub-contracts/commit/06aeebfe2a1a709504f3d901a30b6b47f3aa9a5e))
- package.json ([f74a398](https://github.com/desoul-labs/soulhub-contracts/commit/f74a39821a87fc65a3bb9163dd30884139086268))
- remove files ([487ba64](https://github.com/desoul-labs/soulhub-contracts/commit/487ba64686bb1f3ec81acf1899545c08ed158686))

## [3.0.0](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.2...v3.0.0) (2023-05-14)

## [3.0.0](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.2...v3.0.0) (2023-05-14)

### [0.2.2](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.1...v0.2.2) (2023-05-14)

### [0.2.1](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.0-alpha.1...v0.2.1) (2023-05-14)

### Features

- add modularized contract ([#223](https://github.com/desoul-labs/soulhub-contracts/issues/223)) ([d5bc3d1](https://github.com/desoul-labs/soulhub-contracts/commit/d5bc3d160eef785ed771beb3ec1f1d4832f0187b))
- add unit test & fix bugs ([#220](https://github.com/desoul-labs/soulhub-contracts/issues/220)) ([85ed7af](https://github.com/desoul-labs/soulhub-contracts/commit/85ed7af800df20d2d57b886cb8a72ee7b4aed7ff))
- update soulhub contract ([dd42270](https://github.com/desoul-labs/soulhub-contracts/commit/dd422701f3c5b3803bbe56c9efa5487805d60ce1))

### Bug Fixes

- merge dev ([06aeebf](https://github.com/desoul-labs/soulhub-contracts/commit/06aeebfe2a1a709504f3d901a30b6b47f3aa9a5e))
- package.json ([f74a398](https://github.com/desoul-labs/soulhub-contracts/commit/f74a39821a87fc65a3bb9163dd30884139086268))
- remove files ([487ba64](https://github.com/desoul-labs/soulhub-contracts/commit/487ba64686bb1f3ec81acf1899545c08ed158686))

### [0.2.1-alpha.1](https://github.com/desoul-labs/soulhub-contracts/compare/v0.2.0-alpha.1...v0.2.1-alpha.1) (2023-03-29)

### Features
Expand Down
4 changes: 4 additions & 0 deletions constants/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,8 @@ export const networks: NetworksUserConfig = {
url: 'https://rpc.tenderly.co/fork/fdc07e58-3d7e-4a61-b91f-0bf903e50439',
accounts: [process.env.PRIVATE_KEY ?? ''],
},
astar: {
url: 'https://evm.astar.network/',
accounts: [process.env.PRIVATE_KEY ?? ''],
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
pragma solidity ^0.8.0;

import "./interfaces/IERC5727DelegateUpgradeable.sol";
import "./ERC5727Core.sol";
import "./ERC5727SlotSettableCore.sol";
import "./ERC5727Storage.sol";

contract ERC5727DelegateUpgradeableDS is
IERC5727DelegateUpgradeable,
ERC5727Core
ERC5727SlotSettableCore
{
function __ERC5727Delegate_init() internal onlyInitializing {
__ERC5727Delegate_init_unchained();
Expand Down
19 changes: 11 additions & 8 deletions contracts-modularized/ERC5727/ERC5727EnumerableCore.sol
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ contract ERC5727EnumerableCore is ERC5727Core, ERC3525SlotEnumerableCore {
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
using EnumerableMapUpgradeable for EnumerableMapUpgradeable.AddressToUintMap;

function __ERC5727Enumerable_init() internal onlyInitializing {
__ERC5727Enumerable_init_unchained();
}

function __ERC5727Enumerable_init_unchained() internal onlyInitializing {}

function slotCountOfOwner(address owner) internal view returns (uint256) {
if (owner == address(0)) revert NullValue();

Expand Down Expand Up @@ -110,7 +104,16 @@ contract ERC5727EnumerableCore is ERC5727Core, ERC3525SlotEnumerableCore {
uint256 slot,
uint256 value
) internal virtual override(ERC3525SlotEnumerableCore, ERC5727Core) {
super._beforeValueTransfer(
ERC3525SlotEnumerableCore._beforeValueTransfer(
from,
to,
fromTokenId,
toTokenId,
slot,
value
);

ERC5727Core._beforeValueTransfer(
from,
to,
fromTokenId,
Expand All @@ -136,7 +139,7 @@ contract ERC5727EnumerableCore is ERC5727Core, ERC3525SlotEnumerableCore {
uint256 slot,
uint256 value
) internal virtual override(ERC3525SlotEnumerableCore, ERC3525Core) {
super._afterValueTransfer(
ERC3525SlotEnumerableCore._afterValueTransfer(
from,
to,
fromTokenId,
Expand Down
80 changes: 61 additions & 19 deletions contracts-modularized/ERC5727/ERC5727EnumerableUpgradeableDS.sol
Original file line number Diff line number Diff line change
@@ -1,26 +1,53 @@
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./ERC5727Core.sol";
import "./ERC5727UpgradeableDS.sol";
import "./interfaces/IERC5727EnumerableUpgradeable.sol";
import "../ERC3525/ERC3525SlotEnumerableCore.sol";
import "../ERC3525/ERC3525SlotEnumerableUpgradeableDS.sol";
import "./ERC5727EnumerableStorage.sol";

contract ERC5727EnumerableUpgradeableDS is
ERC5727Core,
ERC3525SlotEnumerableCore
IERC5727EnumerableUpgradeable,
ERC5727UpgradeableDS,
ERC3525SlotEnumerableUpgradeableDS
{
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
using EnumerableMapUpgradeable for EnumerableMapUpgradeable.AddressToUintMap;

function __ERC5727Enumerable_init() internal onlyInitializing {
function init(
string memory name_,
string memory symbol_,
address admin_,
string memory baseUri_,
string memory version_
) external virtual override initializer {
__EIP712_init_unchained(name_, version_);
__ERC721_init_unchained(name_, symbol_, baseUri_);
__ERC3525_init_unchained(18);
__ERC5727_init_unchained(admin_);
__ERC5727Enumerable_init_unchained();
}

function __ERC5727Enumerable_init_unchained() internal onlyInitializing {}

function slotCountOfOwner(address owner) external view returns (uint256) {
function supportsInterface(
bytes4 interfaceId
)
public
view
virtual
override(IERC165Upgradeable, ERC3525UpgradeableDS, ERC5727UpgradeableDS)
returns (bool)
{
return
interfaceId == type(IERC5727EnumerableUpgradeable).interfaceId ||
super.supportsInterface(interfaceId);
}

function slotCountOfOwner(
address owner
) external view override returns (uint256) {
if (owner == address(0)) revert NullValue();

return LibERC5727EnumerableStorage.s()._slotsOfOwner[owner].length();
Expand All @@ -29,7 +56,7 @@ contract ERC5727EnumerableUpgradeableDS is
function slotOfOwnerByIndex(
address owner,
uint256 index
) external view returns (uint256) {
) external view override returns (uint256) {
if (owner == address(0)) revert NullValue();
uint256 slotCountByOwner = LibERC5727EnumerableStorage
.s()
Expand All @@ -44,7 +71,7 @@ contract ERC5727EnumerableUpgradeableDS is
function ownerBalanceInSlot(
address owner,
uint256 slot
) public view returns (uint256) {
) public view override returns (uint256) {
if (owner == address(0)) revert NullValue();
if (!_slotExists(slot)) revert NotFound(slot);

Expand Down Expand Up @@ -95,25 +122,36 @@ contract ERC5727EnumerableUpgradeableDS is
address to,
uint256 firstTokenId,
uint256 batchSize
) internal virtual override(ERC721EnumerableCore, ERC5727Core) {
)
internal
virtual
override(ERC721EnumerableUpgradeable, ERC5727UpgradeableDS)
{
super._beforeTokenTransfer(from, to, firstTokenId, batchSize);
}

function _burn(
uint256 tokenId
) internal virtual override(ERC3525Core, ERC5727Core) {
ERC5727Core._burn(tokenId);
}

function _beforeValueTransfer(
address from,
address to,
uint256 fromTokenId,
uint256 toTokenId,
uint256 slot,
uint256 value
) internal virtual override(ERC3525SlotEnumerableCore, ERC5727Core) {
super._beforeValueTransfer(
)
internal
virtual
override(ERC3525SlotEnumerableUpgradeableDS, ERC5727UpgradeableDS)
{
ERC3525SlotEnumerableUpgradeableDS._beforeValueTransfer(
from,
to,
fromTokenId,
toTokenId,
slot,
value
);

ERC5727UpgradeableDS._beforeValueTransfer(
from,
to,
fromTokenId,
Expand All @@ -138,8 +176,12 @@ contract ERC5727EnumerableUpgradeableDS is
uint256 toTokenId,
uint256 slot,
uint256 value
) internal virtual override(ERC3525SlotEnumerableCore, ERC3525Core) {
super._afterValueTransfer(
)
internal
virtual
override(ERC3525SlotEnumerableUpgradeableDS, ERC3525UpgradeableDS)
{
ERC3525SlotEnumerableUpgradeableDS._afterValueTransfer(
from,
to,
fromTokenId,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
//SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./ERC5727Core.sol";
import "./ERC5727SlotSettableCore.sol";
import "./interfaces/IERC5727ExpirableUpgradeable.sol";
import "./ERC5727Storage.sol";
import "./ERC5727ExpirableUpgradeableStorage.sol";

contract ERC5727ExpirableUpgradeableDS is
IERC5727ExpirableUpgradeable,
ERC5727Core
ERC5727SlotSettableCore
{
modifier onlyManager(uint256 tokenId) {
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// SPDX-License-Identifier: Apache-2.0
pragma solidity ^0.8.0;

import "./ERC5727Core.sol";
import "./ERC5727SlotSettableCore.sol";
import "./interfaces/IERC5727GovernanceUpgradeable.sol";
import "./ERC5727GovernanceStorage.sol";

contract ERC5727GovernanceUpgradeableDS is
IERC5727GovernanceUpgradeable,
ERC5727Core
ERC5727SlotSettableCore
{
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.AddressSet;
using EnumerableSetUpgradeable for EnumerableSetUpgradeable.UintSet;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ pragma solidity ^0.8.0;

import "@openzeppelin/contracts-upgradeable/utils/cryptography/ECDSAUpgradeable.sol";

import "./ERC5727EnumerableCore.sol";
import "./ERC5727SlotSettableCore.sol";
import "./interfaces/IERC5727RecoveryUpgradeable.sol";
import "./ERC5727Storage.sol";

contract ERC5727RecoveryUpgradeableDS is ERC5727EnumerableCore {
contract ERC5727RecoveryUpgradeableDS is ERC5727SlotSettableCore {
event Recovered(address indexed from, address indexed to);
using ECDSAUpgradeable for bytes32;

Expand Down
Loading