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
| pragma solidity ^0.4.24; | |
| contract Fundraiser { | |
| mapping(address=>uint) balances; | |
| // VULNERABLE | |
| function withdrawCoins(){ | |
| uint withdrawAmount = balances[msg.sender]; | |
| Wallet wallet = Wallet(msg.sender); | |
| wallet.payout.value(withdrawAmount)(); |
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
| using NBitcoin; | |
| using NBitcoin.Protocol; | |
| public class LegacyPayToAddress | |
| { | |
| public static void Run() | |
| { | |
| //We will send the coins from this address mtdFu4Qb8why1t71zpUpKkXpsCfjbYbUKj to the one below and has the available output from | |
| //the transaction with the hash 597ca9461b98b541f4d63e4679381947df7698c26750b1ad611bf08e947be2ac | |
| Network network = Network.RegTest; |
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
| use std::thread; | |
| use std::sync::Arc; | |
| use std::sync::atomic::AtomicI32; | |
| use std::sync::atomic::Ordering; | |
| fn main() { | |
| let total = add(46, -4); | |
| println!("total = {};", total) | |
| } | |
| fn add(n1: i32, n2: i32) -> i32 { |
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
| use std::thread; | |
| use std::sync::Arc; | |
| use std::sync::Mutex; | |
| struct Accumulator { | |
| sum: i32, | |
| operation_count: i32, | |
| } | |
| impl Accumulator { |
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
| use std::thread; | |
| use std::sync::mpsc; | |
| fn main() { | |
| let total = add(46, -4); | |
| println!("total = {};", total) | |
| } | |
| fn add(n1: i32, n2: i32) -> i32 { | |
| let mut sum = n1; | |
| let (count, increment) = if n2 > 0 {(n2, 1)} else {(-n2, -1)}; |
OlderNewer