Search
Search titles only
By:
Search titles only
By:
Log in
Register
Search
Search titles only
By:
Search titles only
By:
Menu
Install the app
Install
Forums
New posts
All threads
Latest threads
New posts
Trending threads
Trending
Search forums
What's new
New posts
New ads
New profile posts
Latest activity
Free Ads
Latest reviews
Search ads
Members
Current visitors
New profile posts
Search profile posts
Contact us
Latest ads
ඕනම රටකට සෙට් වෙන CV එකක්
ErMurazor
Updated:
Saturday at 9:50 AM
Hambantota
7 Acres Beachfront Land For Sell DownSouth , PerPerch Price 420 000
1024 Digital
Updated:
Wednesday at 11:57 AM
Baseus PI LITE INDOOR CAMERA
ErMurazor
Updated:
Oct 12, 2026
Ad icon
Colombo
Hard Disk For Sale
mazza
Updated:
Oct 10, 2026
land for sale
justasking
Updated:
Oct 10, 2026
Electronics
Vehicles
Property
Search
Reply to thread
Forums
General
Education
Blockchain/Web3/P2P Developer Study Guide
Get the App
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Message
<blockquote data-quote="හෙළයෙක්" data-source="post: 27802925" data-attributes="member: 503645"><p>මේක ඉගෙන ගන්න අයට වැදගත්ම වෙන දෙයක් තමා ටෙස්ට් කේස් කියන්නෙ. අපි මේකෙත් බැක් එන්ඩ් එකක් තමා ලියන්නෙ ප්රශ්නෙ තියෙන්නෙ අපිට අපි දන්න අනික් බැක් එන්ඩ් වගේ කොන්සොල් ලොග් ගහල බලන්න බැරි එකයි. ඒකට එකම විසදුම තමා ටෙස්ට් කෙස්.</p><p></p><p>මුලින් රීමික් අයිඩී එකෙන් වැඩේ පටන් ගත්තට පස්සෙ මෙන්න මෙයාගෙන් වැඩේ කරන්න පටන් ගන්න.</p><p><a href="https://hardhat.org/tutorial" target="_blank">https://hardhat.org/tutorial</a></p><p>[MEDIA=youtube]9Qpi80dQsGU[/MEDIA]</p><p></p><p>එතකොට අපිට මේ වගේ ස්මාර්ට් කන්ට්රැක් වල තියෙන ෆන්ශන් වලට ටෙස්ට් කෙස් මේ පහල අලවල තියෙන රූප වගේ ලස්සනට ලියන්න පුලුවන්.</p><p></p><p>ස්මාර්ට් කන්ට්රැක් ඩිප්ලොයි කරොත් ආයෙ වෙනස් කරන්න බෑ. ඒ නිසා අපි ප්රොජෙක්ට් එකක් කරද්දි සෑහෙන්න පරිස්සන් වෙන්න ඕනි. ඩිප්ලොයි කරාට පස්සෙ වෙනස් කරනව කියන්නෙ සෑහෙන කොස්ට් එකක් යන වැඩක්.</p><p></p><p>Sample Test case ekak එකකුත් ඔන්න දැම්ම. මේව දැකල ආසාව උපද්දගෙන ඉක්මනට වැඩේ පටන් ගන්න. වසන්ත කාලය ලගම එනව ක්රිප්ටො ඩිවලොපර්ස්ලට.</p><p></p><p>[CODE=javascript]import {ethers} from "hardhat";</p><p>import {assert, expect} from "chai";</p><p>import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers";</p><p>import {ToBigNumber} from "./utils";</p><p></p><p>describe("ABC", function () {</p><p></p><p> let owner: SignerWithAddress;</p><p> let developer: SignerWithAddress;</p><p> let initiativeWallet: SignerWithAddress;</p><p> let stakeWallet: SignerWithAddress;</p><p></p><p> beforeEach(async function () {</p><p> const [_owner, _developer, _bob, _alice] = await ethers.getSigners()</p><p> owner = _owner</p><p> developer = _developer</p><p> initiativeWallet = _bob</p><p> stakeWallet = _alice</p><p> const NFTToken = await ethers.getContractFactory("ABCToken")</p><p> const token = await NFTToken.deploy(initiativeWallet.address, stakeWallet.address)</p><p> this.contract = await token.deployed()</p><p> })</p><p></p><p> describe('deployment', async function () {</p><p> it('deploys successfully', async function () {</p><p> const address = this.contract.address</p><p> assert.notEqual(address, 0x0)</p><p> assert.notEqual(address, '')</p><p> assert.notEqual(address, null)</p><p> assert.notEqual(address, undefined)</p><p></p><p> const balance = await this.contract.balanceOf(owner.address)</p><p> expect(balance).to.be.equal(ToBigNumber(444 * 1e6 * 1e18))</p><p></p><p> })</p><p> })</p><p></p><p> describe('mint', async function () {</p><p> it('mint successfully', async function () {</p><p> const tx = await this.contract.mint(ethers.utils.parseEther("1"))</p><p> await tx.wait()</p><p> const bobBalance = await this.contract.balanceOf(initiativeWallet.address)</p><p> // const aliceBalance = await this.contract.balanceOf(stakeWallet.address)</p><p> expect(bobBalance).to.be.equal(ToBigNumber(0.15 * 1e18))</p><p> // expect(aliceBalance).to.be.equal(ToBigNumber(0.85 * 1e18))</p><p> })</p><p> })</p><p></p><p> describe('burn', async function () {</p><p> it('mint successfully', async function () {</p><p> const tx = await this.contract.mint(ethers.utils.parseEther("1"))</p><p> await tx.wait()</p><p> let ownerBalance = await this.contract.balanceOf(owner.address)</p><p> let initiativeBalance = await this.contract.balanceOf(initiativeWallet.address)</p><p> let stakeBalance = await this.contract.balanceOf(stakeWallet.address)</p><p> expect(ownerBalance).to.be.equal(ToBigNumber(444 * 1e6 * 1e18))</p><p> expect(initiativeBalance).to.be.equal(ToBigNumber(0.15 * 1e18))</p><p> expect(stakeBalance).to.be.equal(ToBigNumber(0.85 * 1e18))</p><p></p><p> const tx2 = await this.contract.initiateChargingPoint()</p><p> await tx2.wait()</p><p> ownerBalance = await this.contract.balanceOf(owner.address)</p><p> initiativeBalance = await this.contract.balanceOf(initiativeWallet.address)</p><p> // stakeBalance = await this.contract.balanceOf(stakeWallet.address)</p><p> expect(ownerBalance).to.be.equal(ToBigNumber(88 * 1e6 * 1e18 - 50 * 1e3 * 1e18))</p><p> expect(initiativeBalance).to.be.equal(ToBigNumber(0.15 * 1e18))</p><p> expect(stakeBalance).to.be.equal(ToBigNumber(0.85 * 1e18))</p><p> })</p><p> })</p><p></p><p>});</p><p>[/CODE]</p><p></p><p><img src="https://i.imgur.com/0mjOuCj.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p><p></p><p><img src="https://i.imgur.com/EtByXmQ.png" alt="" class="fr-fic fr-dii fr-draggable " style="" /></p></blockquote><p></p>
[QUOTE="හෙළයෙක්, post: 27802925, member: 503645"] මේක ඉගෙන ගන්න අයට වැදගත්ම වෙන දෙයක් තමා ටෙස්ට් කේස් කියන්නෙ. අපි මේකෙත් බැක් එන්ඩ් එකක් තමා ලියන්නෙ ප්රශ්නෙ තියෙන්නෙ අපිට අපි දන්න අනික් බැක් එන්ඩ් වගේ කොන්සොල් ලොග් ගහල බලන්න බැරි එකයි. ඒකට එකම විසදුම තමා ටෙස්ට් කෙස්. මුලින් රීමික් අයිඩී එකෙන් වැඩේ පටන් ගත්තට පස්සෙ මෙන්න මෙයාගෙන් වැඩේ කරන්න පටන් ගන්න. [URL]https://hardhat.org/tutorial[/URL] [MEDIA=youtube]9Qpi80dQsGU[/MEDIA] එතකොට අපිට මේ වගේ ස්මාර්ට් කන්ට්රැක් වල තියෙන ෆන්ශන් වලට ටෙස්ට් කෙස් මේ පහල අලවල තියෙන රූප වගේ ලස්සනට ලියන්න පුලුවන්. ස්මාර්ට් කන්ට්රැක් ඩිප්ලොයි කරොත් ආයෙ වෙනස් කරන්න බෑ. ඒ නිසා අපි ප්රොජෙක්ට් එකක් කරද්දි සෑහෙන්න පරිස්සන් වෙන්න ඕනි. ඩිප්ලොයි කරාට පස්සෙ වෙනස් කරනව කියන්නෙ සෑහෙන කොස්ට් එකක් යන වැඩක්. Sample Test case ekak එකකුත් ඔන්න දැම්ම. මේව දැකල ආසාව උපද්දගෙන ඉක්මනට වැඩේ පටන් ගන්න. වසන්ත කාලය ලගම එනව ක්රිප්ටො ඩිවලොපර්ස්ලට. [CODE=javascript]import {ethers} from "hardhat"; import {assert, expect} from "chai"; import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {ToBigNumber} from "./utils"; describe("ABC", function () { let owner: SignerWithAddress; let developer: SignerWithAddress; let initiativeWallet: SignerWithAddress; let stakeWallet: SignerWithAddress; beforeEach(async function () { const [_owner, _developer, _bob, _alice] = await ethers.getSigners() owner = _owner developer = _developer initiativeWallet = _bob stakeWallet = _alice const NFTToken = await ethers.getContractFactory("ABCToken") const token = await NFTToken.deploy(initiativeWallet.address, stakeWallet.address) this.contract = await token.deployed() }) describe('deployment', async function () { it('deploys successfully', async function () { const address = this.contract.address assert.notEqual(address, 0x0) assert.notEqual(address, '') assert.notEqual(address, null) assert.notEqual(address, undefined) const balance = await this.contract.balanceOf(owner.address) expect(balance).to.be.equal(ToBigNumber(444 * 1e6 * 1e18)) }) }) describe('mint', async function () { it('mint successfully', async function () { const tx = await this.contract.mint(ethers.utils.parseEther("1")) await tx.wait() const bobBalance = await this.contract.balanceOf(initiativeWallet.address) // const aliceBalance = await this.contract.balanceOf(stakeWallet.address) expect(bobBalance).to.be.equal(ToBigNumber(0.15 * 1e18)) // expect(aliceBalance).to.be.equal(ToBigNumber(0.85 * 1e18)) }) }) describe('burn', async function () { it('mint successfully', async function () { const tx = await this.contract.mint(ethers.utils.parseEther("1")) await tx.wait() let ownerBalance = await this.contract.balanceOf(owner.address) let initiativeBalance = await this.contract.balanceOf(initiativeWallet.address) let stakeBalance = await this.contract.balanceOf(stakeWallet.address) expect(ownerBalance).to.be.equal(ToBigNumber(444 * 1e6 * 1e18)) expect(initiativeBalance).to.be.equal(ToBigNumber(0.15 * 1e18)) expect(stakeBalance).to.be.equal(ToBigNumber(0.85 * 1e18)) const tx2 = await this.contract.initiateChargingPoint() await tx2.wait() ownerBalance = await this.contract.balanceOf(owner.address) initiativeBalance = await this.contract.balanceOf(initiativeWallet.address) // stakeBalance = await this.contract.balanceOf(stakeWallet.address) expect(ownerBalance).to.be.equal(ToBigNumber(88 * 1e6 * 1e18 - 50 * 1e3 * 1e18)) expect(initiativeBalance).to.be.equal(ToBigNumber(0.15 * 1e18)) expect(stakeBalance).to.be.equal(ToBigNumber(0.85 * 1e18)) }) }) }); [/CODE] [IMG]https://i.imgur.com/0mjOuCj.png[/IMG] [IMG]https://i.imgur.com/EtByXmQ.png[/IMG] [/QUOTE]
Insert quotes…
Verification
Hath warak paha keeyada? (hatha wadikireema paha)
Post reply
Top
Bottom