Commit Graph

11 Commits

Author SHA1 Message Date
r4bbit a8e509baf7 feat(CollectibleV1): add `safeBatchTransferFrom` capabilities
This is to allow batch transfers of community collectibles as discussed
in #41.

Closes #41, #42, #43, #44
2024-02-26 13:48:36 +01:00
0xb337r007 6f83e7346c
add CommunityVault contract (#22)
* add CommunityVault contract

* use named import

* test vault transfer functions for erc20 and erc721

* fix camel case test name

* update format with latest version of forge
2023-12-12 23:10:27 +01:00
Cuteivist 1085ee8308
feat: Add base url to community ERC20 (#21) 2023-10-18 12:12:29 +02:00
r4bbit ea7ef0ef61
feat: introduce custom `StatusMint()` events (#18) 2023-10-06 10:21:27 +02:00
0xb337r007 ff01f8e818
add master/owner tokens to erc20 token (#19) 2023-10-06 09:21:03 +02:00
r4bbit e7d799b761
refactor: use immutable properties where possible (#5)
This commit changes a few token properties to be `immutable` as this
reduces gas costs even further.

This was reported by Slither.

A gas report with changes in gas cost is attached.
2023-09-22 12:32:38 +02:00
r4bbit 8f633ee442
refactor: use `Ownable2Step` instead of `Ownable` (#10)
This has been discussed in #7 and be further explored in https://github.com/OpenZeppelin/openzeppelin-contracts/pull/3620

Closes #7
2023-09-22 12:23:00 +02:00
r4bbit 16121a4f72
feat: add token specific deploy events in deployer contract (#14)
While the underlying factories emit a `CreateToken` event, there was a
request to have specific deployment events for each token emitted by the
deployer.
2023-09-22 12:11:16 +02:00
r4bbit 69e0e5eeaf
refactor: introduce custom errors for better gas costs (#3)
This commit introduces custom errors for `BaseToken` and
`CommunityERC20` to reduce the gas costs in revert cases. Using
`require()` with a string error message requires every character of the
message to be store in memory which costs more gas than a fixed sized
error selector. Hence, it's recommended to use custom errors instead.

A gas snapshot is attached in this commit to show the improved gas
costs.
2023-09-20 07:30:25 +02:00
r4bbit 4be8613d6e
feat: implement `CommunityTokenDeployer` contract (#2)
This commit introduces the `CommunityTokenDeployer` contract discussed
in https://github.com/status-im/status-desktop/issues/11954.

The idea is that, instead of having accounts deploy `OwnerToken` and
`MasterToken` directly, they'd use a deployer contract instead, which
maintains a registry of known `OwnerToken` addresses, mapped to Status
community addresses.

The following changes have been made:

It was, and still is, a requirement that both, `OwnerToken` and
`MasterToken` are deployed within a single transaction, so that when
something goes wrong, we don't end up in an inconsistent state.

That's why `OwnerToken` used to instantiated `MasterToken` and required
all of its constructor arguments as well.

Unfortunately, this resulted in compilation issues in the context of the
newly introduce deployer contract, where there are too many function
arguments.

Because we now delegate deployment to a dedicated contract, we can
instantiate both `OwnerToken` and `MasterToken` in a single transaction,
without having `OwnerToken` being responsible to instantiate
`MasterToken`.

This fixes the compilation issues and simplifies the constructor of
`OwnerToken`.

The new `CommunityTokenDeployer` contract is now responsble for
deploying the aforementioned tokens and ensures that they are deployed
within a single transaction.

To deploy an `OwnerToken` and `MasterToken` accounts can now call
`CommunityDeloyerToken.deploy(TokenConfig, TokenConfig,
DeploymentSignature)`.

The `DeploymentSignature` uses `EIP712` structured type hash data to let
the contract verify that the deployer is allowed to deploy the contracts
on behalf of a community account.
2023-09-19 11:39:55 +02:00
r4bbit c2f500c2e5
refactor: move project to foundry template and introduce tests
This commit does a couple of things:

- moves the project to our foundry template structure and workflows
- removes hardhat usage and dependencies
- removes unused contracts
- ports existing JS tests to foundry tests
- adds additional tests for `CommunityERC20` contract
- Introduces deploy scripts written in solidity which are also covered
  by tests

The projects can now be build and tests with:

```
$ forge build
```

```
$ forge test
```

Test deployments can be done via

```
$ forge script script/DeployOwnerToken.sol
```
2023-09-08 12:36:20 +02:00