-
Notifications
You must be signed in to change notification settings - Fork 88
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added raffle, avatar and collection factory deployment scripts
- Loading branch information
Showing
45 changed files
with
1,671 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
packages/deploy/deploy/17_raffle_care_bears/010_deploy_raffle_care_bears.ts
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,45 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
const {deploy} = deployments; | ||
|
||
const {deployer, upgradeAdmin, treasury, raffleSignWallet} = | ||
await getNamedAccounts(); | ||
|
||
const TRUSTED_FORWARDER = await deployments.get('TRUSTED_FORWARDER_V2'); | ||
let metadataUrl; | ||
if (hre.network.name === 'polygon') { | ||
metadataUrl = 'https://contracts.sandbox.game/carebears-unrevealed/'; | ||
} else { | ||
metadataUrl = 'https://contracts-demo.sandbox.game/carebears-unrevealed/'; | ||
} | ||
|
||
await deploy('RaffleCareBears', { | ||
from: deployer, | ||
contract: 'CareBears', | ||
proxy: { | ||
owner: upgradeAdmin, | ||
proxyContract: 'OpenZeppelinTransparentProxy', | ||
execute: { | ||
methodName: 'initialize', | ||
args: [ | ||
metadataUrl, | ||
'Care Bears', | ||
'CB', | ||
treasury, | ||
raffleSignWallet, | ||
TRUSTED_FORWARDER.address, | ||
], | ||
}, | ||
upgradeIndex: 0, | ||
}, | ||
log: true, | ||
skipIfAlreadyDeployed: true, | ||
}); | ||
}; | ||
|
||
export default func; | ||
func.tags = ['RaffleCareBears', 'RaffleCareBears_deploy']; | ||
func.dependencies = ['TRUSTED_FORWARDER_V2']; |
29 changes: 29 additions & 0 deletions
29
packages/deploy/deploy/17_raffle_care_bears/011_setup_raffle_care_bears_minter.ts
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,29 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments} = hre; | ||
const {get, read, execute, catchUnknownSigner} = deployments; | ||
|
||
const sandContract = await get('PolygonSand'); | ||
const minter = await read('RaffleCareBears', 'allowedToExecuteMint'); | ||
if (minter !== sandContract.address) { | ||
const owner = await read('RaffleCareBears', 'owner'); | ||
await catchUnknownSigner( | ||
execute( | ||
'RaffleCareBears', | ||
{from: owner, log: true}, | ||
'setAllowedExecuteMint', | ||
sandContract.address | ||
) | ||
); | ||
} | ||
}; | ||
|
||
export default func; | ||
func.tags = [ | ||
'RaffleCareBears', | ||
'RaffleCareBears_setup', | ||
'RaffleCareBears_setup_minter', | ||
]; | ||
func.dependencies = ['PolygonSand_deploy', 'RaffleCareBears_deploy']; |
39 changes: 39 additions & 0 deletions
39
packages/deploy/deploy/17_raffle_care_bears/013_setup_raffle_care_bears_wave_0.ts
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,39 @@ | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments} = hre; | ||
const {read, execute, catchUnknownSigner} = deployments; | ||
|
||
const setupWaveMaxTokens = await read('RaffleCareBears', 'waveMaxTokens'); | ||
if (setupWaveMaxTokens.toNumber() === 0) { | ||
const owner = await read('RaffleCareBears', 'owner'); | ||
const waveType = 0; | ||
const waveMaxTokens = 50; | ||
const waveMaxTokensToBuy = 1; | ||
const waveSingleTokenPrice = (150 * 10 ** 18).toString(); | ||
const contractAddress = '0x0000000000000000000000000000000000000000'; | ||
const erc1155Id = 0; | ||
await catchUnknownSigner( | ||
execute( | ||
'RaffleCareBears', | ||
{from: owner, log: true}, | ||
'setupWave', | ||
waveType, | ||
waveMaxTokens, | ||
waveMaxTokensToBuy, | ||
waveSingleTokenPrice, | ||
contractAddress, | ||
erc1155Id | ||
) | ||
); | ||
} | ||
}; | ||
|
||
export default func; | ||
func.tags = [ | ||
'RaffleCareBears', | ||
'RaffleCareBears_setup', | ||
'RaffleCareBears_setup_wave', | ||
]; | ||
func.dependencies = ['RaffleCareBears_deploy']; |
29 changes: 29 additions & 0 deletions
29
packages/deploy/deploy/17_raffle_care_bears/014_setup_raffle_care_bears_signer.ts
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,29 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
const {read, execute, catchUnknownSigner} = deployments; | ||
const {raffleSignWallet} = await getNamedAccounts(); | ||
|
||
const signer = await read('RaffleCareBears', 'signAddress'); | ||
if (signer !== raffleSignWallet) { | ||
const owner = await read('RaffleCareBears', 'owner'); | ||
await catchUnknownSigner( | ||
execute( | ||
'RaffleCareBears', | ||
{from: owner, log: true}, | ||
'setSignAddress', | ||
raffleSignWallet | ||
) | ||
); | ||
} | ||
}; | ||
|
||
export default func; | ||
func.tags = [ | ||
'RaffleCareBears', | ||
'RaffleCareBears_setup', | ||
'RaffleCareBears_setup_signer', | ||
]; | ||
func.dependencies = ['RaffleCareBears_deploy']; |
25 changes: 25 additions & 0 deletions
25
packages/deploy/deploy/17_raffle_care_bears/015_change_owner_care_bears.ts
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,25 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
const {catchUnknownSigner, execute, read} = deployments; | ||
const {sandAdmin} = await getNamedAccounts(); | ||
|
||
const owner = await read('RaffleCareBears', 'owner'); | ||
|
||
if (sandAdmin?.toLocaleLowerCase() !== owner?.toLocaleLowerCase()) { | ||
await catchUnknownSigner( | ||
execute( | ||
'RaffleCareBears', | ||
{from: owner, log: true}, | ||
'transferOwnership', | ||
sandAdmin | ||
) | ||
); | ||
} | ||
}; | ||
|
||
export default func; | ||
func.tags = ['RaffleCareBears', 'RaffleCareBears_change_admin']; | ||
func.dependencies = ['RaffleCareBears_deploy']; |
46 changes: 46 additions & 0 deletions
46
...es/deploy/deploy/18_raffle_playboy_party_people/010_deploy_raffle_playboy_party_people.ts
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,46 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
const {deploy} = deployments; | ||
|
||
const {deployer, upgradeAdmin, treasury, raffleSignWallet} = | ||
await getNamedAccounts(); | ||
|
||
const TRUSTED_FORWARDER = await deployments.get('TRUSTED_FORWARDER_V2'); | ||
|
||
let metadataUrl; | ||
if (hre.network.name === 'polygon') { | ||
metadataUrl = 'https://contracts.sandbox.game/ppp-unrevealed/'; | ||
} else { | ||
metadataUrl = 'https://contracts-demo.sandbox.game/ppp-unrevealed/'; | ||
} | ||
|
||
await deploy('RafflePlayboyPartyPeople', { | ||
from: deployer, | ||
contract: 'PlayboyPartyPeople', | ||
proxy: { | ||
owner: upgradeAdmin, | ||
proxyContract: 'OpenZeppelinTransparentProxy', | ||
execute: { | ||
methodName: 'initialize', | ||
args: [ | ||
metadataUrl, | ||
'Playboy Party People', | ||
'PPP', | ||
treasury, | ||
raffleSignWallet, | ||
TRUSTED_FORWARDER.address, | ||
], | ||
}, | ||
upgradeIndex: 0, | ||
}, | ||
log: true, | ||
skipIfAlreadyDeployed: true, | ||
}); | ||
}; | ||
|
||
export default func; | ||
func.tags = ['RafflePlayboyPartyPeople', 'RafflePlayboyPartyPeople_deploy']; | ||
func.dependencies = ['TRUSTED_FORWARDER_V2']; |
29 changes: 29 additions & 0 deletions
29
...loy/deploy/18_raffle_playboy_party_people/011_setup_raffle_playboy_party_people_minter.ts
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,29 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments} = hre; | ||
const {get, read, execute, catchUnknownSigner} = deployments; | ||
|
||
const sandContract = await get('PolygonSand'); | ||
const minter = await read('RafflePlayboyPartyPeople', 'allowedToExecuteMint'); | ||
if (minter !== sandContract.address) { | ||
const owner = await read('RafflePlayboyPartyPeople', 'owner'); | ||
await catchUnknownSigner( | ||
execute( | ||
'RafflePlayboyPartyPeople', | ||
{from: owner, log: true}, | ||
'setAllowedExecuteMint', | ||
sandContract.address | ||
) | ||
); | ||
} | ||
}; | ||
|
||
export default func; | ||
func.tags = [ | ||
'RafflePlayboyPartyPeople', | ||
'RafflePlayboyPartyPeople_setup', | ||
'RafflePlayboyPartyPeople_setup_minter', | ||
]; | ||
func.dependencies = ['PolygonSand_deploy', 'RafflePlayboyPartyPeople_deploy']; |
42 changes: 42 additions & 0 deletions
42
...loy/deploy/18_raffle_playboy_party_people/013_setup_raffle_playboy_party_people_wave_0.ts
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,42 @@ | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments} = hre; | ||
const {read, execute, catchUnknownSigner} = deployments; | ||
|
||
const setupWaveMaxTokens = await read( | ||
'RafflePlayboyPartyPeople', | ||
'waveMaxTokens' | ||
); | ||
if (setupWaveMaxTokens.toNumber() === 0) { | ||
const owner = await read('RafflePlayboyPartyPeople', 'owner'); | ||
const waveType = 0; | ||
const waveMaxTokens = 500; | ||
const waveMaxTokensToBuy = 500; | ||
const waveSingleTokenPrice = (1 * 10 ** 18).toString(); | ||
const contractAddress = '0x0000000000000000000000000000000000000000'; | ||
const erc1155Id = 0; | ||
await catchUnknownSigner( | ||
execute( | ||
'RafflePlayboyPartyPeople', | ||
{from: owner, log: true}, | ||
'setupWave', | ||
waveType, | ||
waveMaxTokens, | ||
waveMaxTokensToBuy, | ||
waveSingleTokenPrice, | ||
contractAddress, | ||
erc1155Id | ||
) | ||
); | ||
} | ||
}; | ||
|
||
export default func; | ||
func.tags = [ | ||
'RafflePlayboyPartyPeople', | ||
'RafflePlayboyPartyPeople_setup', | ||
'RafflePlayboyPartyPeople_setup_wave', | ||
]; | ||
func.dependencies = ['RafflePlayboyPartyPeople_deploy']; |
29 changes: 29 additions & 0 deletions
29
...loy/deploy/18_raffle_playboy_party_people/014_setup_raffle_playboy_party_people_signer.ts
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,29 @@ | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
const {read, execute, catchUnknownSigner} = deployments; | ||
const {raffleSignWallet} = await getNamedAccounts(); | ||
|
||
const signer = await read('RafflePlayboyPartyPeople', 'signAddress'); | ||
if (signer !== raffleSignWallet) { | ||
const owner = await read('RafflePlayboyPartyPeople', 'owner'); | ||
await catchUnknownSigner( | ||
execute( | ||
'RafflePlayboyPartyPeople', | ||
{from: owner, log: true}, | ||
'setSignAddress', | ||
raffleSignWallet | ||
) | ||
); | ||
} | ||
}; | ||
|
||
export default func; | ||
func.tags = [ | ||
'RafflePlayboyPartyPeople', | ||
'RafflePlayboyPartyPeople_setup', | ||
'RafflePlayboyPartyPeople_setup_signer', | ||
]; | ||
func.dependencies = ['RafflePlayboyPartyPeople_deploy']; |
28 changes: 28 additions & 0 deletions
28
...ges/deploy/deploy/18_raffle_playboy_party_people/015_change_owner_playboy_party_people.ts
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,28 @@ | ||
import {HardhatRuntimeEnvironment} from 'hardhat/types'; | ||
import {DeployFunction} from 'hardhat-deploy/types'; | ||
|
||
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { | ||
const {deployments, getNamedAccounts} = hre; | ||
const {catchUnknownSigner, execute, read} = deployments; | ||
const {sandAdmin} = await getNamedAccounts(); | ||
|
||
const owner = await read('RafflePlayboyPartyPeople', 'owner'); | ||
|
||
if (sandAdmin?.toLocaleLowerCase() !== owner?.toLocaleLowerCase()) { | ||
await catchUnknownSigner( | ||
execute( | ||
'RafflePlayboyPartyPeople', | ||
{from: owner, log: true}, | ||
'transferOwnership', | ||
sandAdmin | ||
) | ||
); | ||
} | ||
}; | ||
|
||
export default func; | ||
func.tags = [ | ||
'RafflePlayboyPartyPeople', | ||
'RafflePlayboyPartyPeople_change_admin', | ||
]; | ||
func.dependencies = ['RafflePlayboyPartyPeople_deploy']; |
Oops, something went wrong.