Skip to content

Instantly share code, notes, and snippets.

@sembrestels
Created July 6, 2022 01:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sembrestels/1e3d939c07b90b1c8d3086f7477f59c1 to your computer and use it in GitHub Desktop.
Save sembrestels/1e3d939c07b90b1c8d3086f7477f59c1 to your computer and use it in GitHub Desktop.
import { ethers } from 'hardhat';
import { Contract } from 'ethers';
import { impersonateAddress, increase } from '../helpers/rpc';
import { expect } from 'chai';
const gardenHolder = '0xf632Ce27Ea72deA30d30C1A9700B6b3bCeAA05cF';
const somebodyElse = "0x4f4f9b8d5b4d0dc10506e5551b0513b61fd59e75"
const hny = "0x6a023ccd1ff6f2045c3309768ead9e68f978f6e1"
describe.only('Token Manager Upgrade', () => {
before('executes the vote #9', async () => {
const [signer] = await ethers.getSigners();
const voting = new Contract("0xfbd0b2726070a9d6aff6d7216c9e9340eae68b2a", [
"event StartVote(uint256 indexed voteId, address indexed creator, bytes context, bytes executionScript)",
"function vote(uint256 _voteId, bool _supports) external",
"function executeVote(uint256 _voteId, bytes _executionScript) external"
], signer)
const voteId = 9
const executionScript = "0x000000018ccbeab14b5ac4a431fffc39f4bec4089020a15500000064ae5b2540f1f3eb40f5bc1ad1344716ced8b8a0431d840b5783aea1fd01786bc26f35ac0fa2a1b99c88fa1519d5f1a8efa0c90cfd0e570095d71a4d45850205108a8f9a70000000000000000000000000bba6f5611202b2e1a24c8cfcbb4278754ebcbe99"
const gardenVoters = [
'0x4ba7362F9189572CbB1216819a45aba0d0B2D1CB',
'0xc89000E12C600b12D6e61a535cD3fedd4ac1eeC4',
'0xdf8f53B9f83e611e1154402992c6F6CB7Daf246c',
];
for (const gardenVoter of gardenVoters) {
await voting
.connect(await impersonateAddress(gardenVoter))
.vote(voteId, true, { gasLimit: 10_000_000 });
}
await increase(String(30 * 24 * 60 * 60));
await (await voting.executeVote(voteId, executionScript)).wait();
});
it('can transfer tokens after the upgrade', async () => {
const signer = await impersonateAddress(gardenHolder);
const token = new Contract(hny, [
"function transfer(address,uint256) external returns (bool)",
"function balanceOf(address) view returns (uint256)"
], signer)
await (await token.transfer(somebodyElse, 1)).wait()
expect(await token.balanceOf(
somebodyElse)).to.be.eq("1")
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment