Skip to content

Commit

Permalink
Merge pull request #12 from BendDAO/seaport_1.6
Browse files Browse the repository at this point in the history
Fix: Upgrade seaport 1.6
  • Loading branch information
thorseldon authored May 14, 2024
2 parents 4cdbf01 + 1a9c9e1 commit 9b30fd7
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 18 deletions.
13 changes: 13 additions & 0 deletions abis/SeaportAdapter.json
Original file line number Diff line number Diff line change
Expand Up @@ -376,6 +376,19 @@
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_seaport",
"type": "address"
}
],
"name": "updateSeaportExchange",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"stateMutability": "payable",
"type": "receive"
Expand Down
27 changes: 12 additions & 15 deletions contracts/adapters/SeaportAdapter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,16 @@ contract SeaportAdapter is BaseAdapter {
ISeaport public seaportExchange;
address public conduitAddress;

function initialize(
address _downpayment,
address _seaportExchange,
address _conduitAddress
) external initializer {
function initialize(address _downpayment, address _seaportExchange, address _conduitAddress) external initializer {
__BaseAdapter_init(NAME, VERSION, _downpayment);
seaportExchange = ISeaport(_seaportExchange);
conduitAddress = _conduitAddress;
}

function updateSeaportExchange(address _seaport) external onlyOwner {
seaportExchange = ISeaport(_seaport);
}

function _checkParams(
address,
uint256,
Expand Down Expand Up @@ -60,11 +60,10 @@ contract SeaportAdapter is BaseAdapter {
});
}

function _hashParams(ISeaport.BasicOrderParameters memory _orderParams, uint256 _nonce)
internal
pure
returns (bytes32)
{
function _hashParams(
ISeaport.BasicOrderParameters memory _orderParams,
uint256 _nonce
) internal pure returns (bytes32) {
return
keccak256(
bytes.concat(
Expand Down Expand Up @@ -96,11 +95,9 @@ contract SeaportAdapter is BaseAdapter {
);
}

function _hashAdditionalRecipient(ISeaport.AdditionalRecipient[] memory recipients)
internal
pure
returns (bytes32)
{
function _hashAdditionalRecipient(
ISeaport.AdditionalRecipient[] memory recipients
) internal pure returns (bytes32) {
bytes memory encoded;
for (uint256 i = 0; i < recipients.length; i++) {
ISeaport.AdditionalRecipient memory recipient = (recipients[i]);
Expand Down
4 changes: 2 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ const config: HardhatUserConfig = {
chainId: 5,
initialBaseFeePerGas: 0,
forking: {
url: NETWORKS_RPC_URL[Network.goerli],
blockNumber: 9487196,
url: NETWORKS_RPC_URL[Network.sepolia],
blockNumber: 5900038,
},
},
sepolia: {
Expand Down
12 changes: 11 additions & 1 deletion tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
WETH,
X2Y2,
} from "../test/config";
import { IDownpayment } from "../typechain-types";
import { IDownpayment, SeaportAdapter } from "../typechain-types";
import {
deployContract,
deployProxyContract,
Expand All @@ -22,6 +22,7 @@ import {
waitForTx,
} from "./utils/helpers";
import { verifyEtherscanContract } from "./utils/verification";
import { Seaport } from "@opensea/seaport-js/lib/typechain/Seaport";

task("deploy:full", "Deploy all contracts").setAction(async (_, { run }) => {
await run("set-DRE");
Expand Down Expand Up @@ -148,6 +149,15 @@ task("config:removeAdapter", "Remove adapter")
await waitForTx(await downpayment.removeAdapter(await getContractAddressFromDB(adapter)));
});

task("upgradeSeaport", "")
.addParam("seaport", "address of seaport")
.setAction(async ({ seaport }, { run }) => {
await run("set-DRE");
await run("compile");
const seaport16Adapter = await getContractFromDB<SeaportAdapter>("Seaport15Adapter");
await waitForTx(await seaport16Adapter.updateSeaportExchange(seaport));
});

task("config:full", "Config adapters")
.addParam("fee", "protocol fee")
.setAction(async ({ fee }, { run }) => {
Expand Down
14 changes: 14 additions & 0 deletions test/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,20 @@ export const Seaport15: Params<string[]> = {
],
};

export const Seaport16: Params<string[]> = {
[Network.sepolia]: [
"0x0000000000000068F116a894984e2DB1123eB395", // exchange
"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000", // OPENSEA_CONDUIT_KEY
"0x1e0049783f008a0085193e00003d00cd54003c71", // OPENSEA_CONDUIT_ADDRESS
],
[Network.goerli]: [],
[Network.mainnet]: [
"0x0000000000000068F116a894984e2DB1123eB395", // exchange
"0x0000007b02230091a7ed01230072f7006a004d60a8d4e71d599b8104250f0000", // OPENSEA_CONDUIT_KEY
"0x1e0049783f008a0085193e00003d00cd54003c71", // OPENSEA_CONDUIT_ADDRESS
],
};

export const X2Y2: Params<string[]> = {
[Network.sepolia]: [
"0x0000000000000000000000000000000000000000", // X2Y2
Expand Down

0 comments on commit 9b30fd7

Please sign in to comment.