Skip to content

Instantly share code, notes, and snippets.

Felix Kuestahler talfco

Block or report user

Report or block talfco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View docker-compose-nextcloud.yml
version: '2'
services:
db:
image: mariadb
restart: always
volumes:
- c:/Users/talfc/DockerVolumes/nextcloud/mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=gugus
View polkawebj-sample001.java
public void run1(String endPoint) {
WsProvider wsProvider = new WsProvider(endPoint);
Promise<ApiPromise> ready = ApiPromise.create(wsProvider);
IRpcFunction.Unsubscribe<Promise> unsubscribeHandler = null;
ready.then( (ApiPromise api) -> {
Promise<IRpcFunction.Unsubscribe<Promise>> invoke = api.rpc().chain().function("subscribeNewHead").invoke(
(IRpcFunction.SubscribeCallback<Header>) (Header header) ->
{
System.out.println("Chain is at block: " + header.getBlockNumber()+" trigger "+count);
View KyberTutorial001-Scenario3.java
private void token2token(String tokenSymbolFrom, String tokenSymbolTo, String tokenQuantity) {
//Suppose we want to convert 100 BAT to DAI tokens, which is a token to token conversion.
// Note that ETH is used as the base pair i.e. BAT -> ETH -> DAI.
Kyber3j kyber3j = Kyber3j.build(new KyberService(KyberService.KYBER_ROPSTEN));
log.info("Connected to Kyber Network: "+KyberService.KYBER_ROPSTEN);
try {
Currencies currencies = kyber3j.currencies().send();
if (!checkForError(currencies) && currencies.existsCurreny(tokenSymbolFrom)
&& currencies.existsCurreny(tokenSymbolTo) ) {
EnabledTokensForWallet tokens = kyber3j.enabledTokensForWallet(credentials.getAddress()).send();
View KyberTutorial001-Scenario2.java
private void token2eth(String tokenSymbol, String tokenQuantity){
Kyber3j kyber3j = Kyber3j.build(new KyberService(KyberService.KYBER_ROPSTEN));
log.info("Connected to Kyber Network: "+KyberService.KYBER_ROPSTEN);
try {
// Check if token is supported
Currencies currencies = kyber3j.currencies().send();
if (!checkForError(currencies) && currencies.existsCurreny(tokenSymbol)) {
EnabledTokensForWallet tokens = kyber3j.enabledTokensForWallet(credentials.getAddress()).send();
if (!checkForError(tokens)){
// Check if wallet is enabled for token
View KyberTutorial001-Scenario1.java
private void eth2token(String tokenSymbol, String tokenQuantity) {
Kyber3j kyber3j = Kyber3j.build(new KyberService(KyberService.KYBER_ROPSTEN));
log.info("Connected to Kyber Network: "+KyberService.KYBER_ROPSTEN);
// ETH2<Token> Swap
try {
// Check if token is supported
Currencies currencies = kyber3j.currencies().send();
log.info("Exists Currency"+tokenSymbol+": " + currencies.existsCurreny(tokenSymbol));
if (!checkForError(currencies) && currencies.existsCurreny(tokenSymbol)) {
// Get buy rates
View KyberTutorial001-KyberAPI.java
package net.cloudburo.kyber.tutorial.protocol;
import net.cloudburo.kyber.tutorial.methods.request.GasPriceRange;
import net.cloudburo.kyber.tutorial.methods.request.SingleRate;
import net.cloudburo.kyber.tutorial.methods.response.*;
import org.web3j.protocol.core.Request;
import java.math.BigInteger;
View KyberTutorial001-Application-main.java
public static void main(String[] args) throws Exception {
Application app = new Application();
log.info(">>> SCENARIO: ETH2TOKEN");
Thread.sleep(3000);
app.eth2token("DAI","2");
log.info(">>> SCENARIO: TOKEN2ETH");
Thread.sleep(3000);
app.token2eth("DAI","1");
log.info(">>> SCENARIO: TOKEN2TOKEN");
Thread.sleep(3000);
@talfco
talfco / Token2ETH.java
Last active Jul 22, 2019
Kyber Swap Example: Token2ETH
View Token2ETH.java
private void token2eth(String tokenSymbol, String tokenQuantity){
Kyber3j kyber3j = Kyber3j.build(new KyberService(KyberService.KYBER_ROPSTEN));
log.info("Connected to Kyber Network: "+KyberService.KYBER_ROPSTEN);
try {
// Check if token is supported
Currencies currencies = kyber3j.currencies().send();
if (!checkForError(currencies) && currencies.existsCurreny(tokenSymbol)) {
EnabledTokensForWallet tokens = kyber3j.enabledTokensForWallet(credentials.getAddress()).send();
// Check if wallet is enabled for token
String tokenId = currencies.getCurrency(tokenSymbol).getId();
@talfco
talfco / ETH2KNCSwap.java
Last active Jul 21, 2019
ETH2KNC Kyber Swap
View ETH2KNCSwap.java
private void eth2knc() {
Kyber3j kyber3j = Kyber3j.build(new KyberService(KyberService.KYBER_ROPSTEN));
log.info("Connected to Kyber Network: "+KyberService.KYBER_ROPSTEN);
// Buy KNC from ETH
try {
// Check if token is supported
Currencies currencies = kyber3j.currencies().send();
log.info("Exists Currency KNC: " + currencies.existsCurreny("KNC"));
if (!checkForError(currencies) && currencies.existsCurreny("KNC")) {
// Get buy rates
View tut02-1-DemoApplication.java
@SpringBootApplication
public class DemoApplication {
Logger logger = LoggerFactory.getLogger(DemoApplication.class);
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
@Bean
You can’t perform that action at this time.