Skip to content

Commit 2a26fc7

Browse files
committed
test(backend): update languages address
#80
1 parent 49d6706 commit 2a26fc7

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

backend/contracts/DistributionQueue.sol

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
pragma solidity ^0.8.28;
33

44
import { ILanguages } from "@elimu-ai/dao-contracts/ILanguages.sol";
5-
import "hardhat/console.sol";
65

76
struct Distribution {
87
string languageCode;
@@ -33,7 +32,6 @@ contract DistributionQueue {
3332
}
3433

3534
function updateOwner(address owner_) public {
36-
console.log("updateOwner");
3735
require(msg.sender == owner, "Only the current owner can set a new owner");
3836
owner = owner_;
3937
emit OwnerUpdated(owner_);
@@ -46,7 +44,6 @@ contract DistributionQueue {
4644
}
4745

4846
function updateQueueHandler(address queueHandler_) public {
49-
console.log("updateQueueHandler");
5047
require(msg.sender == owner, "Only the owner can set the `queueHandler` address");
5148
queueHandler = queueHandler_;
5249
emit QueueHandlerUpdated(queueHandler_);

backend/hardhat-gas-report.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,11 @@
1111
···································|·················|···············|·················|················|···············
1212
| addDistribution · - · - · 146,919 · 4 · - │
1313
···································|·················|···············|·················|················|···············
14-
| updateOwner · - · - · 31,213 · 1 · - │
14+
| updateLanguages · - · - · 30,074 · 1 · - │
1515
···································|·················|···············|·················|················|···············
16-
| updateQueueHandler · - · - · 50,280 · 1 · - │
16+
| updateOwner · - · - · 28,031 · 1 · - │
17+
···································|·················|···············|·················|················|···············
18+
| updateQueueHandler · - · - · 47,098 · 1 · - │
1719
···································|·················|···············|·················|················|···············
1820
| DistributionVerifier · │
1921
···································|·················|···············|·················|················|···············
@@ -51,7 +53,7 @@
5153
···································|·················|···············|·················|················|···············
5254
| Deployments · · % of limit · │
5355
···································|·················|···············|·················|················|···············
54-
| DistributionQueue · - · - · 1,058,635 · 3.5 % · - │
56+
| DistributionQueue · - · - · 1,012,676 · 3.4 % · - │
5557
···································|·················|···············|·················|················|···············
5658
| DistributionVerifier · - · - · 435,156 · 1.5 % · - │
5759
···································|·················|···············|·················|················|···············
@@ -63,7 +65,7 @@
6365
···································|·················|···············|·················|················|···············
6466
| Lock · - · - · 204,541 · 0.7 % · - │
6567
···································|·················|···············|·················|················|···············
66-
| QueueHandler · - · - · 853,619 · 2.8 % · - │
68+
| QueueHandler · - · - · 853,631 · 2.8 % · - │
6769
···································|·················|···············|·················|················|···············
6870
| SponsorshipQueue · 1,094,030 · 1,094,042 · 1,094,036 · 3.6 % · - │
6971
···································|·················|···············|·················|················|···············

backend/test/DistributionQueue.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ describe("DistributionQueue", function () {
1919
const DistributionQueue = await hre.ethers.getContractFactory("DistributionQueue");
2020
const distributionQueue = await DistributionQueue.deploy(await languages.getAddress());
2121

22-
return { distributionQueue, account1, account2 };
22+
return { distributionQueue, languages, account1, account2 };
2323
}
2424

2525
describe("Deployment", function () {
@@ -40,9 +40,19 @@ describe("DistributionQueue", function () {
4040
});
4141
});
4242

43+
describe("Update Languages address", function () {
44+
it("Should change the Languages contract", async function () {
45+
const { distributionQueue, languages, account2 } = await loadFixture(deployFixture);
46+
47+
expect(await distributionQueue.languages()).to.equal(await languages.getAddress());
48+
await distributionQueue.updateLanguages(account2.address);
49+
expect(await distributionQueue.languages()).to.equal(account2.address);
50+
});
51+
});
52+
4353
describe("Update QueueHandler address", function () {
4454
it("Should change the queue handler", async function () {
45-
const { distributionQueue, account1, account2 } = await loadFixture(deployFixture);
55+
const { distributionQueue, account2 } = await loadFixture(deployFixture);
4656

4757
expect(await distributionQueue.queueHandler()).to.equal(ethers.ZeroAddress);
4858
await distributionQueue.updateQueueHandler(account2.address);

0 commit comments

Comments
 (0)