Skip to content

Commit

Permalink
feat: deploy script
Browse files Browse the repository at this point in the history
  • Loading branch information
PARABRAHMAN0 committed Mar 19, 2022
1 parent 1c76201 commit 570185d
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 13 deletions.
48 changes: 48 additions & 0 deletions scripts/typescript/deployRariFuseAllocator.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// libraries, functionality...
import { ethers } from "hardhat";

// types
import { RariFuseAllocator, RariFuseAllocator__factory } from "../../types";
import {
fData,
ProtocolSpecificData,
FuseAllocatorInitData,
} from "../../test/allocators/RariFuseAllocator.test.ts";

// data
import { olympus } from "../../test/utils/olympus";
import { coins } from "../../test/utils/coins";
import { coins } from "../../test/utils/protocols";

async function main() {
const AID: AllocatorInitData = {
authority: olympus.authority,
extender: olympus.extender,
tokens: [],
};

const PSD: ProtocolSpecificData = {
treasury: olympus.treasury,
rewards: protocols.rari.fuse.tribeRewards,
};

const FAID: FuseAllocatorInitData = {
base: AID,
spec: PSD,
};

const factory: RariFuseAllocator__factory = (await ethers.getContractFactory(
"RariFuseAllocator"
)) as RariFuseAllocator__factory;

const allocator: RariFuseAllocator = (await factory.deploy(FAID)) as RariFuseAllocator;

console.log("RariFuseAllocator deployed at:", allocator.address);
}

main()
.then(() => process.exit())
.catch((error) => {
console.error(error);
process.exit(1);
});
26 changes: 13 additions & 13 deletions test/allocators/RariFuseAllocator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,19 +42,19 @@ type ALLOCATORT = RariFuseAllocator;
type FACTORYT = RariFuseAllocator__factory;

/// INTERFACES
interface fData {
export interface fData {
f: string;
idTroller: BigNumber;
base: string;
rT: string;
}

interface ProtocolSpecificData {
export interface ProtocolSpecificData {
treasury: string;
rewards: string;
}

interface FuseAllocatorInitData {
export interface FuseAllocatorInitData {
base: AllocatorInitData;
spec: ProtocolSpecificData;
}
Expand Down Expand Up @@ -501,7 +501,7 @@ describe(ALLOCATORN, () => {
}

// migrate

let fallocator: RariFuseAllocator;

async function beforeEachMigrateTest(): Promise<void> {
Expand Down Expand Up @@ -532,24 +532,24 @@ describe(ALLOCATORN, () => {
it("revert: should fail with wrong access ", async () => {
await expect(allocator.connect(owner).migrate()).to.be.reverted;
for (let i = 1; i < 4; i++) {
await expect(allocator.connect(guardian).update(i)).to.be.reverted;
await expect(allocator.connect(guardian).update(i)).to.be.reverted;
}
});
}

async function migratePassingTests(): Promise<void> {
it("passing: should migrate", async () => {
let balances: BigNumber[] = [];
let balances: BigNumber[] = [];

for ( let i = 0; i < 3; i++) {
balances.push(await utility[i].balanceOf(fallocator.address));
}
for (let i = 0; i < 3; i++) {
balances.push(await utility[i].balanceOf(fallocator.address));
}

await allocator.connect(guardian).migrate()
await allocator.connect(guardian).migrate();

for ( let i = 0; i < 3; i++) {
expect(await utility[i].balanceOf(fallocator.address)).to.be.above(balances[i]);
}
for (let i = 0; i < 3; i++) {
expect(await utility[i].balanceOf(fallocator.address)).to.be.above(balances[i]);
}
});
}

Expand Down

0 comments on commit 570185d

Please sign in to comment.