This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const fromHexString = (inp: Buffer | string): Buffer => { | |
if (typeof inp === 'string') { | |
if (inp.startsWith('0x')) { | |
return Buffer.from(inp.slice(2), 'hex') | |
} | |
return Buffer.from(inp, 'hex') | |
} | |
// If inp is already a Buffer, just return it | |
return inp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package crypto | |
import ( | |
"crypto/ed25519" | |
"crypto/rand" | |
"encoding/hex" | |
"errors" | |
"io" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/ecdsa" | |
"fmt" | |
"log" | |
"github.com/ethereum/go-ethereum/crypto" | |
"github.com/ethereum/go-ethereum/common" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"golang.org/x/crypto/sha3" | |
) | |
func main() { | |
data := "Hello, Ethereum!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/sha256" | |
"fmt" | |
) | |
func main() { | |
hash := sha256.New() | |
hash.Write([]byte("Hello, World!")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity 0.8.4; | |
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol"; | |
contract Erc20Token is ERC20("fire on", "FIO") { | |
constructor() { | |
_mint(address(this), 10000e18); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//SPDX-License-Identifier: GPL-3.0; | |
pragma solidity 0.8.7; | |
contract Energy { | |
//have total supply | |
//transferrable | |
//name | |
//symbol | |
//decimal |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity ^0.8.0; | |
contract Vault { | |
// a contract where the owner create grant for a beneficiary; | |
//allows beneficiary to withdraw only when time elapse | |
//allows owner to withdraw before time elapse | |
//get information of a beneficiary | |
//amount of ethers in the smart contract |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier:MIT | |
pragma solidity 0.8.0; | |
contract Tuple { | |
function getValues() public pure returns (int, bool) { | |
return (49, true); | |
} | |
function get() public pure returns (int) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// SPDX-License-Identifier: GPL-3.0 | |
pragma solidity 0.8.0; | |
contract Bank { | |
address public owner; | |
mapping(address => uint256) depositor; | |
address[] public depositors; | |
constructor() { |
NewerOlder