Skip to content

Zap-tech/finna

Repository files navigation

finna - An Ethereum Blockchain Scratchpad

finna is still in early development, expect things to change

finna is a tool to quickly and easily read to and write smart contracts on the ethereum blockchain, and much more. finna runs in the browser and is powered by fif, a stack-based scripting language.

Here is an example of finna in action

;; finna - An Ethereum Blockchain Scratchpad

;; Some user address that we're interested in
let some-address "0xad7ad87afdafdaf8d7afd8af7d"


;; Let's look at how much eth it has
"some-address has " . (account/balance some-address)$ to-eth . " ETH" . cr


;; This uses etherscan to retrieve the contract ABI functions
let some-erc20-coin "0x32049328432098523059"
(contract/call some-erc20-coin :approve [some-address 10 to-wei]?)$
tx/wait-for ;; Wait for the returned transaction to complete

;; Now that it's populated, this will transfer the given ERC20 coin
;; from the provider (metamask, coinbase, etc) to the given address.
(contract/call some-erc20-coin :transfer-from [some-address 10 to-wei]?)$ tx/wait-for

;; The appropriate prompts will appear to carry out the transaction

;; Assuming the account had no tokens previously, let's now confirm
;; that the transfer completed successfully (there are better ways to
;; do this, this is just a proof of concept)
(contract/call some-erc20-coin :get-balance [some-address])$ 10 to-wei >= if
  "Transfer Completed Successfully!" . cr
else
  "Transfer Failed, or hasn't completed yet!" . cr
then

;; Write word functions
fn approve [address amount] &
  (contract/call some-erc20-coin :approve [address amount] ?)$
endfn

(approve some-address 10 to-wei)$ tx/wait-for

1 Disclaimer

Benjamin Zaporzan and Zaptech Enterprises does not take responsibility for how this tool is used. We also do not take responsibility for stolen or lost cryptocurrency. Please use at your own discretion.