Skip to content

Commit

Permalink
latest rocketh
Browse files Browse the repository at this point in the history
  • Loading branch information
wighawag committed Apr 22, 2024
1 parent ef19ade commit d0f4acc
Show file tree
Hide file tree
Showing 17 changed files with 91 additions and 184 deletions.
6 changes: 3 additions & 3 deletions contracts/deploy/000_debug/001_deploy_time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,16 @@ const timeSalts = {
export default execute(
context,
async (env) => {
const {deploy, accounts, artifacts, network} = env;
const {deploy, namedAccounts, artifacts, network} = env;
const deterministic = timeSalts[network.name] || true;
const deployConfig = getConfig(env);
if (deployConfig.useTimeContract) {
await deploy(
'Time',
{
account: accounts.deployer,
account: namedAccounts.deployer,
artifact: SolidityKit.Time,
args: [accounts.timeOwner],
args: [namedAccounts.timeOwner],
},
{deterministic, skipIfAlreadyDeployed: true},
);
Expand Down
4 changes: 2 additions & 2 deletions contracts/deploy/001_deploy_test_tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {parseEther} from 'viem';

export default execute(
context,
async ({deploy, execute, accounts, artifacts}) => {
const {deployer, tokensBeneficiary} = accounts;
async ({deploy, execute, namedAccounts, artifacts}) => {
const {deployer, tokensBeneficiary} = namedAccounts;

const config = {admin: deployer};

Expand Down
4 changes: 2 additions & 2 deletions contracts/deploy/002_deploy_test_tokens_distributor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {context} from './_context';

export default execute(
context,
async ({deploy, execute, get, accounts, artifacts, network}) => {
const {deployer} = accounts;
async ({deploy, execute, get, namedAccounts, artifacts, network}) => {
const {deployer} = namedAccounts;

const TestTokens = await get<typeof artifacts.TestTokens.abi>('TestTokens');

Expand Down
4 changes: 2 additions & 2 deletions contracts/deploy/010_deploy_gems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {parseEther} from 'viem';

export default execute(
context,
async ({deploy, accounts, artifacts}) => {
const {deployer, tokensBeneficiary} = accounts;
async ({deploy, namedAccounts, artifacts}) => {
const {deployer, tokensBeneficiary} = namedAccounts;
await deploy('Gems', {
account: deployer,
artifact: artifacts.Gems,
Expand Down
6 changes: 3 additions & 3 deletions contracts/deploy/011_deploy_gems_generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {zeroAddress} from 'viem';

export default execute(
context,
async ({deployViaProxy, accounts, artifacts, get, getOrNull, execute, showMessage}) => {
const {deployer, tokensBeneficiary} = accounts;
async ({deployViaProxy, namedAccounts, artifacts, get, getOrNull, execute, showMessage}) => {
const {deployer, tokensBeneficiary} = namedAccounts;

const Gems = await get<typeof artifacts.Gems.abi>('Gems');
const GemsGenerator = await getOrNull<typeof artifacts.RewardsGenerator.abi>('GemsGenerator');
Expand Down Expand Up @@ -38,7 +38,7 @@ export default execute(
],
},
{
owner: accounts.deployer,
owner: namedAccounts.deployer,
execute: 'postUpgrade',
},
);
Expand Down
8 changes: 4 additions & 4 deletions contracts/deploy/020_deploy_game.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ export type GameConfig = {
export default execute(
context,
async (env, configOverride?: Partial<GameConfig>) => {
const {deployViaProxy, deployments, accounts, artifacts, network, deployViaRouter, get} = env;
const {deployer} = accounts;
const {deployViaProxy, deployments, namedAccounts, artifacts, network, deployViaRouter, get} = env;
const {deployer} = namedAccounts;
const deployConfig = getConfig(env);

const startTime = 0; // BigInt(Math.floor(Date.now() / 1000)); // startTime: nextSunday(),
Expand All @@ -42,7 +42,7 @@ export default execute(

const numTokensPerGems = BigInt(10) ** BigInt(decimals);

const admin = accounts.deployer;
const admin = namedAccounts.deployer;

let time: `0x${string}` = zeroAddress;
const timeContract = await deployments['Time'];
Expand Down Expand Up @@ -141,7 +141,7 @@ export default execute(
});
}

const addressesToAuthorize = Object.values(env.accounts).concat([stratagems.address]);
const addressesToAuthorize = Object.values(env.namedAccounts).concat([stratagems.address]);
const anyNotAuthorized = await env.read(testTokens, {
functionName: 'anyNotAuthorized',
args: [addressesToAuthorize],
Expand Down
6 changes: 3 additions & 3 deletions contracts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"@rocketh/deploy-proxy": "^0.10.3",
"@rocketh/deploy-router": "^0.10.3",
"@rocketh/doc": "^0.10.3",
"@rocketh/export": "^0.10.3",
"@rocketh/export": "^0.10.5",
"@rocketh/signer": "^0.10.3",
"@rocketh/verifier": "^0.10.3",
"@rocketh/verifier": "^0.10.5",
"@types/fs-extra": "^11.0.4",
"@types/prompts": "^2.4.9",
"as-soon": "^0.0.8",
Expand All @@ -30,7 +30,7 @@
"prettier": "^3.2.5",
"prettier-plugin-solidity": "^1.3.1",
"prompts": "^2.4.2",
"rocketh": "^0.10.9",
"rocketh": "^0.10.11",
"rollup-plugin-node-builtins": "^2.1.2",
"set-defaults": "^0.0.2",
"solidity-coverage": "^0.8.7",
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/distributeMoreTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ async function main() {
const tx = await env.execute(TestTokens, {
functionName: 'distributeAlongWithETH',
args: [addresses, total],
account: env.accounts.tokensBeneficiary,
account: env.namedAccounts.tokensBeneficiary,
});
console.log(tx);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/distributeTokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ async function main() {
const tx = await env.execute(TestTokens, {
functionName: 'distributeAlongWithETH',
args: [addresses, BigInt(addresses.length) * parseUnits('10', decimals)],
account: env.accounts.tokensBeneficiary,
account: env.namedAccounts.tokensBeneficiary,
});
console.log(tx);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/fixDistribution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async function main() {
const tx = await env.execute(TestTokens, {
functionName: 'transfer',
args: [to.address, to.amount],
account: env.accounts.tokensBeneficiary,
account: env.namedAccounts.tokensBeneficiary,
});
console.log(tx);
}
Expand Down
80 changes: 7 additions & 73 deletions contracts/scripts/fixPointsBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,72 +32,6 @@ async function main() {
}
}

// const toSend = [
// {
// address: '0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF',
// amount: -13000000000000000000n,
// },
// {
// address: '0xD1edDfcc4596CC8bD0bd7495beaB9B979fc50336',
// amount: -1000000000000000000n,
// },
// {
// address: '0xa1D50E107110b293AC0CE32d648A6Bf5AC3f3612',
// amount: -1000000000000000000n,
// },
// {
// address: '0x2981000A489dD625479Bf612A29910F7De8556B4',
// amount: -7000000000000000000n,
// },
// {
// address: '0x143f8cFB7e91b7836D90A06Fe0e2cF8728D61FB0',
// amount: 16000000000000000000n,
// },
// {
// address: '0x9d35cE15c448B5a4f8afC170214F3031878396A3',
// amount: 5000000000000000000n,
// },
// {
// address: '0xAcDb105133b8598A308995FD1EeBAaB155f1a3bf',
// amount: -4000000000000000000n,
// },
// {
// address: '0xC6cCd3c2d63bc8De8fcF43EdE80D135666b7aceE',
// amount: 11000000000000000000n,
// },
// {
// address: '0xF8b109aF18cfA614Bef1C2899e522d77b3C64c14',
// amount: -6000000000000000000n,
// },
// {
// address: '0xFE35e15bE885750D9b2363cbB6aBDd57AC9C4c40',
// amount: -1000000000000000000n,
// },
// {
// address: '0x6bAFF8A3449cc2E196F4b873f49e03E09345B1E1',
// amount: -8000000000000000000n,
// },
// {
// address: '0x9dab5A6393eEf78eB36cd84bB9Bbb055189429A5',
// amount: 11000000000000000000n,
// },
// {
// address: '0xB006c644258e01b437eFF06e16E56e938a239712',
// amount: 5000000000000000000n,
// },
// {
// address: '0xc6a4FCe15Bd4c14f8D6ECf3Ad4e20E39021897E8',
// amount: -1000000000000000000n,
// },
// {
// address: '0xac5b774D7a700AcDb528048B6052bc1549cd73B9',
// amount: -2000000000000000000n,
// },
// {
// address: '0xc6A55a0d7e2a7403fFEADf08A0203AF93bAD7D6e',
// amount: -1000000000000000000n,
// },
// ] as const;
console.log(toSend);

console.log(
Expand All @@ -115,14 +49,14 @@ async function main() {
if (prompt.proceed) {
const enabled = await env.read(GemsGenerator, {
functionName: 'games',
args: [env.accounts.deployer],
args: [env.namedAccounts.deployer],
});
if (!enabled) {
const desiredWeight = parseEther('1');
await env.execute(GemsGenerator, {
functionName: 'enableGame',
args: [env.accounts.deployer, desiredWeight],
account: env.accounts.deployer,
args: [env.namedAccounts.deployer, desiredWeight],
account: env.namedAccounts.deployer,
});
}

Expand All @@ -131,23 +65,23 @@ async function main() {
const tx = await env.execute(GemsGenerator, {
functionName: 'add',
args: [to.address, to.amount],
account: env.accounts.deployer,
account: env.namedAccounts.deployer,
});
console.log(tx);
} else if (to.amount < 0) {
const tx = await env.execute(GemsGenerator, {
functionName: 'remove',
args: [to.address, -to.amount],
account: env.accounts.deployer,
account: env.namedAccounts.deployer,
});
console.log(tx);
}
}

await env.execute(GemsGenerator, {
functionName: 'enableGame',
args: [env.accounts.deployer, 0n],
account: env.accounts.deployer,
args: [env.namedAccounts.deployer, 0n],
account: env.namedAccounts.deployer,
});

for (const address of Object.keys(state.points.shared)) {
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/generateTokenLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ async function main() {
});
if (prompt.proceed) {
const tx = await env.execute(TestTokens, {
account: env.accounts.tokensBeneficiary,
account: env.namedAccounts.tokensBeneficiary,
value,
functionName: 'distributeAlongWithETH',
args: [addresses, BigInt(addresses.length) * numTokensPerAccount],
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/poke.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function main() {
const tx = await env.execute(Stratagems, {
functionName: 'poke',
args: [xyToBigIntID(x, y)],
account: env.accounts.deployer,
account: env.namedAccounts.deployer,
});
console.log(tx);
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/scripts/skipDays.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ async function main() {
const tx = await env.execute(Time, {
functionName: 'increaseTime',
args: [days * 24n * 3600n],
account: env.accounts.deployer,
account: env.namedAccounts.deployer,
});
console.log(tx);
}
Expand Down
4 changes: 2 additions & 2 deletions contracts/scripts/steal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {loadEnvironmentFromHardhat} from 'hardhat-rocketh/helpers';
async function main() {
const env = await loadEnvironmentFromHardhat({hre, context});

const {deployer, tokensBeneficiary} = env.accounts;
const {deployer, tokensBeneficiary} = env.namedAccounts;

const args = process.argv.slice(2);
const addressToStealFrom = args[0] as `0x${string}`;
Expand Down Expand Up @@ -40,7 +40,7 @@ async function main() {
const tx = await env.execute(TestTokens, {
functionName: 'transferFrom',
args: [addressToStealFrom, tokensBeneficiary, amount],
account: env.accounts.deployer,
account: env.namedAccounts.deployer,
});
console.log(tx);

Expand Down
Loading

0 comments on commit d0f4acc

Please sign in to comment.