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

Develop #284

Open
wants to merge 27 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
572add8
feat: update wrapper on arbitrum testnet, base testnet, polygon testnet
Apr 19, 2024
94679b8
chore: deploy contracts to oasys mainnet
Apr 24, 2024
75896ff
Feature/pt 4531 create2 (#280)
ifelsedeveloper Apr 27, 2024
5a04947
fix: build
ifelsedeveloper Apr 27, 2024
5dff72f
chore(release): bump versions after release
ifelsedeveloper Apr 27, 2024
5dd89db
fix: build
ifelsedeveloper Apr 27, 2024
df2b584
chore(release): bump versions after release
ifelsedeveloper Apr 27, 2024
014b6a3
feat: refactoring (#283)
ifelsedeveloper May 3, 2024
32d175c
chore: fix some tests
May 3, 2024
c616042
Feature/pt 5315 3dweb query (#285)
ifelsedeveloper May 4, 2024
fc795d2
Feature/pt 5315 3dweb query (#286)
ifelsedeveloper May 6, 2024
674d7e1
Feature/pt 5315 3dweb query (#287)
ifelsedeveloper May 6, 2024
94873c9
feat: add contracts for amoy
ifelsedeveloper May 7, 2024
c9153ef
feat: deploy specs
ifelsedeveloper May 7, 2024
1469505
feat: add new proxy reader deploys
ifelsedeveloper May 13, 2024
b122176
chore: deployed create2 factory to lisk
evgenynacu May 16, 2024
6c8332e
feat: 3dweb reader for base
ifelsedeveloper Jun 7, 2024
b76a5da
feat: add lightlink for thirdweb query
ifelsedeveloper Jul 3, 2024
39dea11
Merge branch 'master' into develop
ifelsedeveloper Jul 3, 2024
f38e820
[Fixes] PT-5586: Fix all tests in develop-branch (#303)
gonzaotc Jul 17, 2024
3c0518f
Support for flat fees in Drop contracts (#302)
evgenynacu Jul 18, 2024
936a6c0
Merge branch 'master' into develop
ifelsedeveloper Jul 18, 2024
5da6130
feat: update nvm
ifelsedeveloper Jul 18, 2024
3a0c785
Update LibOrderData.md (#301)
gonzaotc Jul 29, 2024
d967fdd
[Feature] PT-5616 Upgradeable ExchangeWrapper + Upgradeability Tests …
gonzaotc Aug 12, 2024
8b0578b
chore: deployed create2 factory on Arbitrum, RARI
evgenynacu Aug 13, 2024
3644945
feat: add reader amoy deploy
ifelsedeveloper Aug 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v18.13.0
v18.17.0
181 changes: 181 additions & 0 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
"packages": ["projects/**"],
"npmClient": "yarn",
"version": "0.8.4-beta.3",
"version": "0.8.7",
"command": {
"version": {
"allowBranch": ["master", "develop", "feature/*"]
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@
"private": true,
"workspaces": [
"projects/*"
],
],
"scripts": {
"bootstrap": "lerna bootstrap --no-ci && lerna link",
"bootstrap:ci": "lerna bootstrap --ci && lerna link",
"build": "sh scripts/build.sh",
"test": "sh scripts/test.sh",
"test": "yarn workspaces run test",
"release": "git reset --hard && lerna publish from-package",
"build:deploy": "yarn workspace @rarible/deploy run build",
"build:exchange-v2": "yarn workspace @rarible/exchange-v2 run build",
Expand Down Expand Up @@ -45,5 +45,6 @@
"tslib": "^2.5.0",
"typechain": "^8.2.0",
"typescript": "^5.0.4"
}
},
"packageManager": "yarn@1.22.22+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
8 changes: 8 additions & 0 deletions projects/custom-matchers/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.8.6](https://github.com/rariblecom/protocol-contracts/compare/v0.8.1...v0.8.6) (2024-04-27)

**Note:** Version bump only for package @rarible/custom-matchers

## [0.8.5](https://github.com/rariblecom/protocol-contracts/compare/v0.8.1...v0.8.5) (2024-04-27)

**Note:** Version bump only for package @rarible/custom-matchers

## [0.8.4-beta.3](https://github.com/rariblecom/protocol-contracts/compare/v0.8.4-beta.2...v0.8.4-beta.3) (2024-01-19)

**Note:** Version bump only for package @rarible/custom-matchers
Expand Down
9 changes: 5 additions & 4 deletions projects/custom-matchers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@rarible/custom-matchers",
"version": "0.8.4-beta.3",
"version": "0.8.6",
"description": "Custom matchers for different asset classes",
"files": [
"contracts",
Expand All @@ -22,8 +22,8 @@
"url": "https://github.com/rariblecom/protocol-contracts/issues"
},
"dependencies": {
"@rarible/exchange-interfaces": "^0.8.4-beta.3",
"@rarible/lazy-mint": "^0.8.4-beta.3",
"@rarible/exchange-interfaces": "^0.8.6",
"@rarible/lazy-mint": "^0.8.6",
"ethers": "5.7.2",
"truffle-plugin-verify": "^0.6.5"
},
Expand All @@ -38,6 +38,7 @@
},
"gitHead": "c149f3e740650a91e0764245230dbddc8f8f423e",
"scripts": {
"build": "truffle compile --all && typechain --target ethers-v5 'build/contracts/*.json' && tsc -skipLibCheck"
"build": "truffle compile --all && typechain --target ethers-v5 'build/contracts/*.json' && tsc -skipLibCheck",
"test": "pwd"
}
}
2 changes: 2 additions & 0 deletions projects/deploy-proxy/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
artifacts
cache
32 changes: 32 additions & 0 deletions projects/deploy-proxy/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Change Log

All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

## [0.8.7](https://github.com/rarible/protocol-contracts/compare/v0.8.6...v0.8.7) (2024-04-27)

### Bug Fixes

- build ([5dd89db](https://github.com/rarible/protocol-contracts/commit/5dd89db7b71e0e965dc7944d54878d119160e2cb))

## [0.8.6](https://github.com/rarible/protocol-contracts/compare/v0.8.1...v0.8.6) (2024-04-27)

**Note:** Version bump only for package @rarible/deploy-proxy

## [0.8.5](https://github.com/rarible/protocol-contracts/compare/v0.8.1...v0.8.5) (2024-04-27)

### Bug Fixes

- build and deploy ([146e65d](https://github.com/rarible/protocol-contracts/commit/146e65d789f64b6154f5b111ed403d51c7b93efb))

### Features

- add config for sei and camp ([9815c1a](https://github.com/rarible/protocol-contracts/commit/9815c1aa90543667549d9ed4ba183e1fc2be4e14))
- add deploy ([ad072dc](https://github.com/rarible/protocol-contracts/commit/ad072dc43edd19973e7c5dc539dcdba1edf6e638))
- add deploy support for factory ([f9a1160](https://github.com/rarible/protocol-contracts/commit/f9a11605766a943f56d004c07d6a4c32b1d26cd1))
- add deployment for sepolia and mumbai ([84e0c50](https://github.com/rarible/protocol-contracts/commit/84e0c508bd956f3dc793b19a42e6a8e4e8482edb))
- add hardhat deploy for factory ([898bb86](https://github.com/rarible/protocol-contracts/commit/898bb8641c3349baef58a5738818c0d8c101dc61))
- add lisk_sepolia ([fc372bd](https://github.com/rarible/protocol-contracts/commit/fc372bd2694d3ee09d8f336a77f48f6f389c89ed))
- add new ([a75d810](https://github.com/rarible/protocol-contracts/commit/a75d810e4d244a37c53eeee3b3e0b8b9b5965b91))
- add new deploy frame config ([b518b62](https://github.com/rarible/protocol-contracts/commit/b518b6255d23c9bb15f87e6058730f8c66057ea6))
- add verify ([f3b2ff1](https://github.com/rarible/protocol-contracts/commit/f3b2ff1f797664223db5d8b9c7bbde5f88cb0449))
205 changes: 205 additions & 0 deletions projects/deploy-proxy/contracts/ImmutableCreate2Factory.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
// SPDX-License-Identifier: MIT

pragma solidity 0.5.10; // optimization enabled, 99999 runs, evm: petersburg


/**
* @title Immutable Create2 Contract Factory
* @author 0age
* @notice This contract provides a safeCreate2 function that takes a salt value
* and a block of initialization code as arguments and passes them into inline
* assembly. The contract prevents redeploys by maintaining a mapping of all
* contracts that have already been deployed, and prevents frontrunning or other
* collisions by requiring that the first 20 bytes of the salt are equal to the
* address of the caller (this can be bypassed by setting the first 20 bytes to
* the null address). There is also a view function that computes the address of
* the contract that will be created when submitting a given salt or nonce along
* with a given block of initialization code.
* @dev This contract has not yet been fully tested or audited - proceed with
* caution and please share any exploits or optimizations you discover.
*/
contract ImmutableCreate2Factory {
// mapping to track which addresses have already been deployed.
mapping(address => bool) private _deployed;

/**
* @dev Create a contract using CREATE2 by submitting a given salt or nonce
* along with the initialization code for the contract. Note that the first 20
* bytes of the salt must match those of the calling address, which prevents
* contract creation events from being submitted by unintended parties.
* @param salt bytes32 The nonce that will be passed into the CREATE2 call.
* @param initializationCode bytes The initialization code that will be passed
* into the CREATE2 call.
* @return Address of the contract that will be created, or the null address
* if a contract already exists at that address.
*/
function safeCreate2(
bytes32 salt,
bytes calldata initializationCode
) external payable containsCaller(salt) returns (address deploymentAddress) {
// move the initialization code from calldata to memory.
bytes memory initCode = initializationCode;

// determine the target address for contract deployment.
address targetDeploymentAddress = address(
uint160( // downcast to match the address type.
uint256( // convert to uint to truncate upper digits.
keccak256( // compute the CREATE2 hash using 4 inputs.
abi.encodePacked( // pack all inputs to the hash together.
hex"ff", // start with 0xff to distinguish from RLP.
address(this), // this contract will be the caller.
salt, // pass in the supplied salt value.
keccak256( // pass in the hash of initialization code.
abi.encodePacked(
initCode
)
)
)
)
)
)
);

// ensure that a contract hasn't been previously deployed to target address.
require(
!_deployed[targetDeploymentAddress],
"Invalid contract creation - contract has already been deployed."
);

// using inline assembly: load data and length of data, then call CREATE2.
assembly { // solhint-disable-line
let encoded_data := add(0x20, initCode) // load initialization code.
let encoded_size := mload(initCode) // load the init code's length.
deploymentAddress := create2( // call CREATE2 with 4 arguments.
callvalue, // forward any attached value.
encoded_data, // pass in initialization code.
encoded_size, // pass in init code's length.
salt // pass in the salt value.
)
}

// check address against target to ensure that deployment was successful.
require(
deploymentAddress == targetDeploymentAddress,
"Failed to deploy contract using provided salt and initialization code."
);

// record the deployment of the contract to prevent redeploys.
_deployed[deploymentAddress] = true;
}

/**
* @dev Compute the address of the contract that will be created when
* submitting a given salt or nonce to the contract along with the contract's
* initialization code. The CREATE2 address is computed in accordance with
* EIP-1014, and adheres to the formula therein of
* `keccak256( 0xff ++ address ++ salt ++ keccak256(init_code)))[12:]` when
* performing the computation. The computed address is then checked for any
* existing contract code - if so, the null address will be returned instead.
* @param salt bytes32 The nonce passed into the CREATE2 address calculation.
* @param initCode bytes The contract initialization code to be used.
* that will be passed into the CREATE2 address calculation.
* @return Address of the contract that will be created, or the null address
* if a contract has already been deployed to that address.
*/
function findCreate2Address(
bytes32 salt,
bytes calldata initCode
) external view returns (address deploymentAddress) {
// determine the address where the contract will be deployed.
deploymentAddress = address(
uint160( // downcast to match the address type.
uint256( // convert to uint to truncate upper digits.
keccak256( // compute the CREATE2 hash using 4 inputs.
abi.encodePacked( // pack all inputs to the hash together.
hex"ff", // start with 0xff to distinguish from RLP.
address(this), // this contract will be the caller.
salt, // pass in the supplied salt value.
keccak256( // pass in the hash of initialization code.
abi.encodePacked(
initCode
)
)
)
)
)
)
);

// return null address to signify failure if contract has been deployed.
if (_deployed[deploymentAddress]) {
return address(0);
}
}

/**
* @dev Compute the address of the contract that will be created when
* submitting a given salt or nonce to the contract along with the keccak256
* hash of the contract's initialization code. The CREATE2 address is computed
* in accordance with EIP-1014, and adheres to the formula therein of
* `keccak256( 0xff ++ address ++ salt ++ keccak256(init_code)))[12:]` when
* performing the computation. The computed address is then checked for any
* existing contract code - if so, the null address will be returned instead.
* @param salt bytes32 The nonce passed into the CREATE2 address calculation.
* @param initCodeHash bytes32 The keccak256 hash of the initialization code
* that will be passed into the CREATE2 address calculation.
* @return Address of the contract that will be created, or the null address
* if a contract has already been deployed to that address.
*/
function findCreate2AddressViaHash(
bytes32 salt,
bytes32 initCodeHash
) external view returns (address deploymentAddress) {
// determine the address where the contract will be deployed.
deploymentAddress = address(
uint160( // downcast to match the address type.
uint256( // convert to uint to truncate upper digits.
keccak256( // compute the CREATE2 hash using 4 inputs.
abi.encodePacked( // pack all inputs to the hash together.
hex"ff", // start with 0xff to distinguish from RLP.
address(this), // this contract will be the caller.
salt, // pass in the supplied salt value.
initCodeHash // pass in the hash of initialization code.
)
)
)
)
);

// return null address to signify failure if contract has been deployed.
if (_deployed[deploymentAddress]) {
return address(0);
}
}

/**
* @dev Determine if a contract has already been deployed by the factory to a
* given address.
* @param deploymentAddress address The contract address to check.
* @return True if the contract has been deployed, false otherwise.
*/
function hasBeenDeployed(
address deploymentAddress
) external view returns (bool) {
// determine if a contract has been deployed to the provided address.
return _deployed[deploymentAddress];
}

/**
* @dev Modifier to ensure that the first 20 bytes of a submitted salt match
* those of the calling account. This provides protection against the salt
* being stolen by frontrunners or other attackers. The protection can also be
* bypassed if desired by setting each of the first 20 bytes to zero.
* @param salt bytes32 The salt value to check against the calling address.
*/
modifier containsCaller(bytes32 salt) {
// prevent contract submissions from being stolen from tx.pool by requiring
// that the first 20 bytes of the submitted salt match msg.sender.
require(
(address(bytes20(salt)) == msg.sender) ||
(bytes20(salt) == bytes20(0)),
"Invalid salt - first 20 bytes of the salt must match calling address."
);
_;
}
}
24 changes: 24 additions & 0 deletions projects/deploy-proxy/contracts/TestDeployContract.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.7.6;

contract TestDeployContract {
// State variables to store the values
uint256 public value1;
uint256 public value2;

// Constructor with two parameters to initialize the state variables
constructor(uint256 _value1, uint256 _value2) {
value1 = _value1;
value2 = _value2;
}

// Function to get the first value
function getValue1() public view returns (uint256) {
return value1;
}

// Function to get the second value
function getValue2() public view returns (uint256) {
return value2;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { DeployFunction, DeployResult } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const deployLock: DeployFunction = async (
hre: HardhatRuntimeEnvironment
) => {
const { deploy } = hre.deployments;
const { getNamedAccounts } = hre;
const na = await getNamedAccounts()
const {deployer,} = await getNamedAccounts();
console.log('deployer', deployer, JSON.stringify(na))
const deployResult: DeployResult = await deploy("ImmutableCreate2Factory", {
from: deployer,
log: true,
args: [], // Unlock timestamp in seconds
waitConfirmations: 1,
nonce: 0
});
console.log("transactionHash", deployResult.transactionHash)

};

export default deployLock;
deployLock.tags = ["all", "ImmutableCreate2Factory"];
23 changes: 23 additions & 0 deletions projects/deploy-proxy/deploy/01-deploy-contract-via-factory.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { DeployFunction, DeployResult } from "hardhat-deploy/dist/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const deployLock: DeployFunction = async (
hre: HardhatRuntimeEnvironment
) => {
const { deploy } = hre.deployments;
const { getNamedAccounts } = hre;
const {deployer,} = await getNamedAccounts();
console.log('deployer', deployer)

const deployResult: DeployResult = await deploy("TestDeployContract", {
from: deployer,
log: true,
args: [100, 200], // Unlock timestamp in seconds
waitConfirmations: 1,
deterministicDeployment: "0x11111",
});
console.log("transactionHash", deployResult.transactionHash)
};

export default deployLock;
deployLock.tags = ["all", "TestDeployContract"];
Loading