-
Notifications
You must be signed in to change notification settings - Fork 427
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SDK] Fix
invalid recipient
issue when deploy built-in contracts (#…
- Loading branch information
Kien Ngo
authored
Dec 15, 2023
1 parent
b7d4dee
commit fed1313
Showing
7 changed files
with
197 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
"@thirdweb-dev/sdk": patch | ||
--- | ||
|
||
Fix deploy issue "invalid recipient" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { constants } from "ethers"; | ||
|
||
/** | ||
* In the past we default `platform_fee_recipient` and `primary_sale_recipient` to AddressZero. | ||
* However due to a recent change in our smart contract extensions (PrimarySale & PlatformFee), AddressZero is no longer an accepted value for those fields. | ||
* So now we set the default value to the signer address. | ||
* https://github.com/thirdweb-dev/contracts/pull/530 | ||
* | ||
* @param signerAddress - The address of the contract deployer | ||
* @param recipient - The address that will receive the platform fees and/or sale fees | ||
* @returns `signerAddress` if the `recipient` is AddressZero, otherwise returns `recipient` | ||
* @internal | ||
*/ | ||
export function overrideRecipientAddress( | ||
signerAddress: string, | ||
recipient: string, | ||
): string { | ||
if (recipient === constants.AddressZero) { | ||
return signerAddress; | ||
} | ||
return recipient; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.