Skip to content

Commit

Permalink
added raffle, avatar and collection factory deployment scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
abarbatei committed Oct 3, 2023
1 parent 583d989 commit ddae02f
Show file tree
Hide file tree
Showing 45 changed files with 1,671 additions and 0 deletions.
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'];
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'];
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'];
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'];
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'];
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'];
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'];
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'];
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'];
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'];
Loading

0 comments on commit ddae02f

Please sign in to comment.