Bourne's Blog - A Full-stack & Web3 Developer

「big data era」

Solidity Exercise - TimelockEscrow/TripleNestedMapping/...

TimelockEscrow The goal of this exercise is to create a Time lock escrow. A buyer deposits ether into a contract, and the seller cannot withdraw it until 3 days passes. Before that, the buyer...

Solidity Exercise - Inheritance/NestedArray/...

Inheritance Override 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.13; // You may not modify this contract contract Number { fun...

Solidity Exercise - Idiot Betting Game

Idiot Betting Game This exercise assumes you know how block.timestamp works. Whoever deposits the most ether into a contract wins all the ether if no-one else deposits after an hour. ...

Solidity Exercise - FizzBuzz

FizzBuzz // if n is divisible by 3, return “fizz” // if n is divisible by 5, return “buzz” // if n is divisible be 3 and 5, return “fizz buzz” // otherwise, return an empty string Coding 1 2 3 4...

Solidity Exercise - Fabonacci

Fabonacci This exercise assumes you understand what Fibonacci sequence is. Function fibonacci takes a uint256 as argument and returns nth fibonacci number. Fibonacci sequence are 0,1,1,2,3,5...

Solidity Exercise - Encoder

Encoder This exercise assumes you know how abi encoding works. In the createEncodedData function below, write the logic that creates an encoded data of a string and uint256, based on the f...

Solidity Exercise - Donations

Donations Design a contract to receive donations from users, but remember a user can donate multiple times. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^...

Solidity Exercise - Divide

Divide 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 // SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.13; contract Divide { uint256 public constant PERCENTAGE_INTEREST = 3; /** ...

Solidity Exercise - Distribute Transfer V2

Distribute Transfer V2 This exercise assumes you know how to sending Ether. This contract has some ether in it, distribute it equally among the array of addresses that is passed as argument. ...

Solidity Exercise - Distribute Transfer

Distribute Transfer This exercise assumes you know how to sending Ether. This contract has some ether in it, distribute it equally among the array of addresses that is passed as argument. 1 2 3 ...